GitHub PullRequestReviewCommentEvent at 2014-10-15 13:31:05
Repository: feeder
Actor: sindrenm
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/hyperoslo/feeder/pulls/comments/18892962","id":18892962,"diff_hunk":"@@ -114,6 +114,27 @@ Feeder.configure do |config|\n end\n ```\n \n+You have access to the controller in the scope, which enables you to do cool\n+stuff like this:\n+\n+```ruby\n+Feeder.configure do |config|\n+  # A list of scopes that will be applied to the feed items in the controller.\n+  config.scopes << proc { |ctrl| limit ctrl.params[:limit] }\n+end\n+```\n+\n+If your scope evaluates to `nil` it will not be applied to prevent it from\n+breaking the scope chain. This enables optional paramaters by doing something\n+like this:\n+\n+```ruby\n+Feeder.configure do |config|\n+  # A list of scopes that will be applied to the feed items in the controller.\n+  config.scopes << proc { |ctrl| ctrl.params.has_key?(:limit) limit(ctrl.params[:limit]) : nil }","path":"README.md","position":21,"original_position":21,"commit_id":"63106a564bc75ec1e64558780920a2fd60a2adca","original_commit_id":"63106a564bc75ec1e64558780920a2fd60a2adca","user":{"login":"sindrenm","id":386122,"avatar_url":"https://avatars.githubusercontent.com/u/386122?v=2","gravatar_id":"","url":"https://api.github.com/users/sindrenm","html_url":"https://github.com/sindrenm","followers_url":"https://api.github.com/users/sindrenm/followers","following_url":"https://api.github.com/users/sindrenm/following{/other_user}","gists_url":"https://api.github.com/users/sindrenm/gists{/gist_id}","starred_url":"https://api.github.com/users/sindrenm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindrenm/subscriptions","organizations_url":"https://api.github.com/users/sindrenm/orgs","repos_url":"https://api.github.com/users/sindrenm/repos","events_url":"https://api.github.com/users/sindrenm/events{/privacy}","received_events_url":"https://api.github.com/users/sindrenm/received_events","type":"User","site_admin":false},"body":"Well, actually, you wouldn't need to change anything if you recreate it with the same name as the one from the gem (_Feeder::ItemsController_), like this:\r\n\r\n```\r\nmodule Feeder\r\n  class ItemsController < ApplicationController\r\n    include ::Feeder::Concerns::Controllers::ItemsController\r\n  end\r\nend\r\n```","created_at":"2014-10-15T13:31:05Z","updated_at":"2014-10-15T13:31:05Z","html_url":"https://github.com/hyperoslo/feeder/pull/15#discussion_r18892962","pull_request_url":"https://api.github.com/repos/hyperoslo/feeder/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/hyperoslo/feeder/pulls/comments/18892962"},"html":{"href":"https://github.com/hyperoslo/feeder/pull/15#discussion_r18892962"},"pull_request":{"href":"https://api.github.com/repos/hyperoslo/feeder/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/hyperoslo/feeder/pulls/15","id":22703311,"html_url":"https://github.com/hyperoslo/feeder/pull/15","diff_url":"https://github.com/hyperoslo/feeder/pull/15.diff","patch_url":"https://github.com/hyperoslo/feeder/pull/15.patch","issue_url":"https://api.github.com/repos/hyperoslo/feeder/issues/15","number":15,"state":"open","locked":false,"title":"Enable the use of parameters in scopes","user":{"login":"espenhogbakk","id":394587,"avatar_url":"https://avatars.githubusercontent.com/u/394587?v=2","gravatar_id":"","url":"https://api.github.com/users/espenhogbakk","html_url":"https://github.com/espenhogbakk","followers_url":"https://api.github.com/users/espenhogbakk/followers","following_url":"https://api.github.com/users/espenhogbakk/following{/other_user}","gists_url":"https://api.github.com/users/espenhogbakk/gists{/gist_id}","starred_url":"https://api.github.com/users/espenhogbakk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/espenhogbakk/subscriptions","organizations_url":"https://api.github.com/users/espenhogbakk/orgs","repos_url":"https://api.github.com/users/espenhogbakk/repos","events_url":"https://api.github.com/users/espenhogbakk/events{/privacy}","received_events_url":"https://api.github.com/users/espenhogbakk/received_events","type":"User","site_admin":false},"body":"By passing in the controller it self to the scopes when we evaluate them, we can do stuff like checking controller parameters to check what we should filter with the scope.","created_at":"2014-10-14T11:04:56Z","updated_at":"2014-10-15T13:31:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c6b0816716cf5cd351ba047d423820f457f4eb2f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hyperoslo/feeder/pulls/15/commits","review_comments_url":"https://api.github.com/repos/hyperoslo/feeder/pulls/15/comments","review_comment_url":"https://api.github.com/repos/hyperoslo/feeder/pulls/comments/{number}","comments_url":"https://api.github.com/repos/hyperoslo/feeder/issues/15/comments","statuses_url":"https://api.github.com/repos/hyperoslo/feeder/statuses/63106a564bc75ec1e64558780920a2fd60a2adca","head":{"label":"hyperoslo:feature/parameters-in-scopes","ref":"feature/parameters-in-scopes","sha":"63106a564bc75ec1e64558780920a2fd60a2adca","user":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=2","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"repo":{"id":17827215,"name":"feeder","full_name":"hyperoslo/feeder","owner":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=2","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hyperoslo/feeder","description":"Provides simple feed functionality through an engine","fork":false,"url":"https://api.github.com/repos/hyperoslo/feeder","forks_url":"https://api.github.com/repos/hyperoslo/feeder/forks","keys_url":"https://api.github.com/repos/hyperoslo/feeder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hyperoslo/feeder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hyperoslo/feeder/teams","hooks_url":"https://api.github.com/repos/hyperoslo/feeder/hooks","issue_events_url":"https://api.github.com/repos/hyperoslo/feeder/issues/events{/number}","events_url":"https://api.github.com/repos/hyperoslo/feeder/events","assignees_url":"https://api.github.com/repos/hyperoslo/feeder/assignees{/user}","branches_url":"https://api.github.com/repos/hyperoslo/feeder/branches{/branch}","tags_url":"https://api.github.com/repos/hyperoslo/feeder/tags","blobs_url":"https://api.github.com/repos/hyperoslo/feeder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hyperoslo/feeder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hyperoslo/feeder/git/refs{/sha}","trees_url":"https://api.github.com/repos/hyperoslo/feeder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hyperoslo/feeder/statuses/{sha}","languages_url":"https://api.github.com/repos/hyperoslo/feeder/languages","stargazers_url":"https://api.github.com/repos/hyperoslo/feeder/stargazers","contributors_url":"https://api.github.com/repos/hyperoslo/feeder/contributors","subscribers_url":"https://api.github.com/repos/hyperoslo/feeder/subscribers","subscription_url":"https://api.github.com/repos/hyperoslo/feeder/subscription","commits_url":"https://api.github.com/repos/hyperoslo/feeder/commits{/sha}","git_commits_url":"https://api.github.com/repos/hyperoslo/feeder/git/commits{/sha}","comments_url":"https://api.github.com/repos/hyperoslo/feeder/comments{/number}","issue_comment_url":"https://api.github.com/repos/hyperoslo/feeder/issues/comments/{number}","contents_url":"https://api.github.com/repos/hyperoslo/feeder/contents/{+path}","compare_url":"https://api.github.com/repos/hyperoslo/feeder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hyperoslo/feeder/merges","archive_url":"https://api.github.com/repos/hyperoslo/feeder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hyperoslo/feeder/downloads","issues_url":"https://api.github.com/repos/hyperoslo/feeder/issues{/number}","pulls_url":"https://api.github.com/repos/hyperoslo/feeder/pulls{/number}","milestones_url":"https://api.github.com/repos/hyperoslo/feeder/milestones{/number}","notifications_url":"https://api.github.com/repos/hyperoslo/feeder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hyperoslo/feeder/labels{/name}","releases_url":"https://api.github.com/repos/hyperoslo/feeder/releases{/id}","created_at":"2014-03-17T12:30:12Z","updated_at":"2014-09-04T16:09:16Z","pushed_at":"2014-10-15T07:47:24Z","git_url":"git://github.com/hyperoslo/feeder.git","ssh_url":"git@github.com:hyperoslo/feeder.git","clone_url":"https://github.com/hyperoslo/feeder.git","svn_url":"https://github.com/hyperoslo/feeder","homepage":"http://rubygems.org/gems/feeder","size":891,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":5,"default_branch":"master"}},"base":{"label":"hyperoslo:master","ref":"master","sha":"a985fe770d2cae4f2c312e0aa60054e04c126d2b","user":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=2","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"repo":{"id":17827215,"name":"feeder","full_name":"hyperoslo/feeder","owner":{"login":"hyperoslo","id":1340892,"avatar_url":"https://avatars.githubusercontent.com/u/1340892?v=2","gravatar_id":"","url":"https://api.github.com/users/hyperoslo","html_url":"https://github.com/hyperoslo","followers_url":"https://api.github.com/users/hyperoslo/followers","following_url":"https://api.github.com/users/hyperoslo/following{/other_user}","gists_url":"https://api.github.com/users/hyperoslo/gists{/gist_id}","starred_url":"https://api.github.com/users/hyperoslo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyperoslo/subscriptions","organizations_url":"https://api.github.com/users/hyperoslo/orgs","repos_url":"https://api.github.com/users/hyperoslo/repos","events_url":"https://api.github.com/users/hyperoslo/events{/privacy}","received_events_url":"https://api.github.com/users/hyperoslo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hyperoslo/feeder","description":"Provides simple feed functionality through an engine","fork":false,"url":"https://api.github.com/repos/hyperoslo/feeder","forks_url":"https://api.github.com/repos/hyperoslo/feeder/forks","keys_url":"https://api.github.com/repos/hyperoslo/feeder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hyperoslo/feeder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hyperoslo/feeder/teams","hooks_url":"https://api.github.com/repos/hyperoslo/feeder/hooks","issue_events_url":"https://api.github.com/repos/hyperoslo/feeder/issues/events{/number}","events_url":"https://api.github.com/repos/hyperoslo/feeder/events","assignees_url":"https://api.github.com/repos/hyperoslo/feeder/assignees{/user}","branches_url":"https://api.github.com/repos/hyperoslo/feeder/branches{/branch}","tags_url":"https://api.github.com/repos/hyperoslo/feeder/tags","blobs_url":"https://api.github.com/repos/hyperoslo/feeder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hyperoslo/feeder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hyperoslo/feeder/git/refs{/sha}","trees_url":"https://api.github.com/repos/hyperoslo/feeder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hyperoslo/feeder/statuses/{sha}","languages_url":"https://api.github.com/repos/hyperoslo/feeder/languages","stargazers_url":"https://api.github.com/repos/hyperoslo/feeder/stargazers","contributors_url":"https://api.github.com/repos/hyperoslo/feeder/contributors","subscribers_url":"https://api.github.com/repos/hyperoslo/feeder/subscribers","subscription_url":"https://api.github.com/repos/hyperoslo/feeder/subscription","commits_url":"https://api.github.com/repos/hyperoslo/feeder/commits{/sha}","git_commits_url":"https://api.github.com/repos/hyperoslo/feeder/git/commits{/sha}","comments_url":"https://api.github.com/repos/hyperoslo/feeder/comments{/number}","issue_comment_url":"https://api.github.com/repos/hyperoslo/feeder/issues/comments/{number}","contents_url":"https://api.github.com/repos/hyperoslo/feeder/contents/{+path}","compare_url":"https://api.github.com/repos/hyperoslo/feeder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hyperoslo/feeder/merges","archive_url":"https://api.github.com/repos/hyperoslo/feeder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hyperoslo/feeder/downloads","issues_url":"https://api.github.com/repos/hyperoslo/feeder/issues{/number}","pulls_url":"https://api.github.com/repos/hyperoslo/feeder/pulls{/number}","milestones_url":"https://api.github.com/repos/hyperoslo/feeder/milestones{/number}","notifications_url":"https://api.github.com/repos/hyperoslo/feeder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hyperoslo/feeder/labels{/name}","releases_url":"https://api.github.com/repos/hyperoslo/feeder/releases{/id}","created_at":"2014-03-17T12:30:12Z","updated_at":"2014-09-04T16:09:16Z","pushed_at":"2014-10-15T07:47:24Z","git_url":"git://github.com/hyperoslo/feeder.git","ssh_url":"git@github.com:hyperoslo/feeder.git","clone_url":"https://github.com/hyperoslo/feeder.git","svn_url":"https://github.com/hyperoslo/feeder","homepage":"http://rubygems.org/gems/feeder","size":891,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hyperoslo/feeder/pulls/15"},"html":{"href":"https://github.com/hyperoslo/feeder/pull/15"},"issue":{"href":"https://api.github.com/repos/hyperoslo/feeder/issues/15"},"comments":{"href":"https://api.github.com/repos/hyperoslo/feeder/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/hyperoslo/feeder/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/hyperoslo/feeder/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/hyperoslo/feeder/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/hyperoslo/feeder/statuses/63106a564bc75ec1e64558780920a2fd60a2adca"}}}}