{"action":"created","comment":{"url":"https://api.github.com/repos/brightin/brightcontent/pulls/comments/22727552","id":22727552,"diff_hunk":"@@ -1,3 +1,5 @@\n+ENV['RANSACK_FORM_BUILDER'] ||= '::SimpleForm::FormBuilder'","path":"core/lib/brightcontent/core.rb","position":1,"original_position":1,"commit_id":"13d55106893d3adcd3fdd735b2f9d077b27cfe50","original_commit_id":"13d55106893d3adcd3fdd735b2f9d077b27cfe50","user":{"login":"jvdp","id":241947,"avatar_url":"https://avatars.githubusercontent.com/u/241947?v=3","gravatar_id":"","url":"https://api.github.com/users/jvdp","html_url":"https://github.com/jvdp","followers_url":"https://api.github.com/users/jvdp/followers","following_url":"https://api.github.com/users/jvdp/following{/other_user}","gists_url":"https://api.github.com/users/jvdp/gists{/gist_id}","starred_url":"https://api.github.com/users/jvdp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvdp/subscriptions","organizations_url":"https://api.github.com/users/jvdp/orgs","repos_url":"https://api.github.com/users/jvdp/repos","events_url":"https://api.github.com/users/jvdp/events{/privacy}","received_events_url":"https://api.github.com/users/jvdp/received_events","type":"User","site_admin":false},"body":"What's this for?","created_at":"2015-01-09T16:59:07Z","updated_at":"2015-01-09T16:59:07Z","html_url":"https://github.com/brightin/brightcontent/pull/35#discussion_r22727552","pull_request_url":"https://api.github.com/repos/brightin/brightcontent/pulls/35","_links":{"self":{"href":"https://api.github.com/repos/brightin/brightcontent/pulls/comments/22727552"},"html":{"href":"https://github.com/brightin/brightcontent/pull/35#discussion_r22727552"},"pull_request":{"href":"https://api.github.com/repos/brightin/brightcontent/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/brightin/brightcontent/pulls/35","id":27037588,"html_url":"https://github.com/brightin/brightcontent/pull/35","diff_url":"https://github.com/brightin/brightcontent/pull/35.diff","patch_url":"https://github.com/brightin/brightcontent/pull/35.patch","issue_url":"https://api.github.com/repos/brightin/brightcontent/issues/35","number":35,"state":"open","locked":false,"title":"Custom filter options","user":{"login":"s-andringa","id":54975,"avatar_url":"https://avatars.githubusercontent.com/u/54975?v=3","gravatar_id":"","url":"https://api.github.com/users/s-andringa","html_url":"https://github.com/s-andringa","followers_url":"https://api.github.com/users/s-andringa/followers","following_url":"https://api.github.com/users/s-andringa/following{/other_user}","gists_url":"https://api.github.com/users/s-andringa/gists{/gist_id}","starred_url":"https://api.github.com/users/s-andringa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s-andringa/subscriptions","organizations_url":"https://api.github.com/users/s-andringa/orgs","repos_url":"https://api.github.com/users/s-andringa/repos","events_url":"https://api.github.com/users/s-andringa/events{/privacy}","received_events_url":"https://api.github.com/users/s-andringa/received_events","type":"User","site_admin":false},"body":"Adds the ability to customize filters, alike ActiveAdmin, using the power of SimpleForm.\r\n\r\n### Defining filters\r\n\r\n`filter_fields` now also accepts filter options through a hash:\r\n```ruby\r\n# Current syntax hasn't changed:\r\nfilter_fields \"author\", \"name\"\r\n\r\n# You can also use symbols now:\r\nfilter_fields :author, :name\r\n\r\n# Passing options:\r\nfilter_fields author: { ... }, name: { ... }\r\n\r\n# Combining both styles is possible:\r\nfilter_fields :author, name: { ... }\r\n```\r\n\r\n### Options\r\n\r\nAll options for `SimpleForm::FormBuilder#input` are accepted and work as expected, such as `:as`, `:input_html`, and `:label_method`.\r\n\r\n#### Changed and additional options\r\n\r\n##### <tt>:collection</tt>\r\n\r\nAs SimpleForm's <tt>:collection</tt> option, but also accepts a Proc or method name as a symbol. The default hasn't changed and is only applied if a collection type filter is used (eg. `:select`).\r\n\r\n##### <tt>:predicate</tt>\r\n\r\nLets you specify the Ransack search predicate to be used. Defaults to \"cont\" for string type filters (`:string` or `:search`) and to \"eq\" for all other types.\r\n\r\n### Examples\r\n\r\n```ruby\r\nclass BlogsController < Brightcontent::BaseController\r\n  # Free form text filter, returns all blogs where name contains given query:\r\n  filter_fields name: { as: :string, predicate: \"cont\" }\r\n  \r\n  # Same as above:\r\n  filter_fields name: { as: :string }\r\n\r\n  # Customized label:\r\n  filter_fields author: { label: \"Written by\" }\r\n\r\n  # Select filter with custom options:\r\n  filter_fields name: { collection: %w(Arthur Slartibartfast Trinity) } \r\n\r\n  # Belongs-to filter with custom options:\r\n  filter_fields author: { collection: ->{ Author.order(:name) }, label_method: :display_name }\r\n\r\n  # Or by means of a controller method:\r\n  filter_fields author: { collection: :published_authors }\r\n\r\n  # Or even a fully customized filter, using a fictitious custom SimpleForm input field:\r\n  filter_fields author: { as: :remote_select, url: \"/authors.json?order=name\" }\r\n\r\n  private\r\n\r\n  def published_authors\r\n    Author.published\r\n  end\r\nend\r\n```","created_at":"2015-01-08T15:56:53Z","updated_at":"2015-01-09T16:59:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"73699b24cdafe32fdc51b77c036e77c57d298441","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/brightin/brightcontent/pulls/35/commits","review_comments_url":"https://api.github.com/repos/brightin/brightcontent/pulls/35/comments","review_comment_url":"https://api.github.com/repos/brightin/brightcontent/pulls/comments/{number}","comments_url":"https://api.github.com/repos/brightin/brightcontent/issues/35/comments","statuses_url":"https://api.github.com/repos/brightin/brightcontent/statuses/13d55106893d3adcd3fdd735b2f9d077b27cfe50","head":{"label":"s-andringa:feature/filter-options","ref":"feature/filter-options","sha":"13d55106893d3adcd3fdd735b2f9d077b27cfe50","user":{"login":"s-andringa","id":54975,"avatar_url":"https://avatars.githubusercontent.com/u/54975?v=3","gravatar_id":"","url":"https://api.github.com/users/s-andringa","html_url":"https://github.com/s-andringa","followers_url":"https://api.github.com/users/s-andringa/followers","following_url":"https://api.github.com/users/s-andringa/following{/other_user}","gists_url":"https://api.github.com/users/s-andringa/gists{/gist_id}","starred_url":"https://api.github.com/users/s-andringa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s-andringa/subscriptions","organizations_url":"https://api.github.com/users/s-andringa/orgs","repos_url":"https://api.github.com/users/s-andringa/repos","events_url":"https://api.github.com/users/s-andringa/events{/privacy}","received_events_url":"https://api.github.com/users/s-andringa/received_events","type":"User","site_admin":false},"repo":{"id":28955325,"name":"brightcontent","full_name":"s-andringa/brightcontent","owner":{"login":"s-andringa","id":54975,"avatar_url":"https://avatars.githubusercontent.com/u/54975?v=3","gravatar_id":"","url":"https://api.github.com/users/s-andringa","html_url":"https://github.com/s-andringa","followers_url":"https://api.github.com/users/s-andringa/followers","following_url":"https://api.github.com/users/s-andringa/following{/other_user}","gists_url":"https://api.github.com/users/s-andringa/gists{/gist_id}","starred_url":"https://api.github.com/users/s-andringa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s-andringa/subscriptions","organizations_url":"https://api.github.com/users/s-andringa/orgs","repos_url":"https://api.github.com/users/s-andringa/repos","events_url":"https://api.github.com/users/s-andringa/events{/privacy}","received_events_url":"https://api.github.com/users/s-andringa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/s-andringa/brightcontent","description":"BrightContent, yet another cms / admin panel for Rails","fork":true,"url":"https://api.github.com/repos/s-andringa/brightcontent","forks_url":"https://api.github.com/repos/s-andringa/brightcontent/forks","keys_url":"https://api.github.com/repos/s-andringa/brightcontent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/s-andringa/brightcontent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/s-andringa/brightcontent/teams","hooks_url":"https://api.github.com/repos/s-andringa/brightcontent/hooks","issue_events_url":"https://api.github.com/repos/s-andringa/brightcontent/issues/events{/number}","events_url":"https://api.github.com/repos/s-andringa/brightcontent/events","assignees_url":"https://api.github.com/repos/s-andringa/brightcontent/assignees{/user}","branches_url":"https://api.github.com/repos/s-andringa/brightcontent/branches{/branch}","tags_url":"https://api.github.com/repos/s-andringa/brightcontent/tags","blobs_url":"https://api.github.com/repos/s-andringa/brightcontent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/s-andringa/brightcontent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/s-andringa/brightcontent/git/refs{/sha}","trees_url":"https://api.github.com/repos/s-andringa/brightcontent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/s-andringa/brightcontent/statuses/{sha}","languages_url":"https://api.github.com/repos/s-andringa/brightcontent/languages","stargazers_url":"https://api.github.com/repos/s-andringa/brightcontent/stargazers","contributors_url":"https://api.github.com/repos/s-andringa/brightcontent/contributors","subscribers_url":"https://api.github.com/repos/s-andringa/brightcontent/subscribers","subscription_url":"https://api.github.com/repos/s-andringa/brightcontent/subscription","commits_url":"https://api.github.com/repos/s-andringa/brightcontent/commits{/sha}","git_commits_url":"https://api.github.com/repos/s-andringa/brightcontent/git/commits{/sha}","comments_url":"https://api.github.com/repos/s-andringa/brightcontent/comments{/number}","issue_comment_url":"https://api.github.com/repos/s-andringa/brightcontent/issues/comments/{number}","contents_url":"https://api.github.com/repos/s-andringa/brightcontent/contents/{+path}","compare_url":"https://api.github.com/repos/s-andringa/brightcontent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/s-andringa/brightcontent/merges","archive_url":"https://api.github.com/repos/s-andringa/brightcontent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/s-andringa/brightcontent/downloads","issues_url":"https://api.github.com/repos/s-andringa/brightcontent/issues{/number}","pulls_url":"https://api.github.com/repos/s-andringa/brightcontent/pulls{/number}","milestones_url":"https://api.github.com/repos/s-andringa/brightcontent/milestones{/number}","notifications_url":"https://api.github.com/repos/s-andringa/brightcontent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/s-andringa/brightcontent/labels{/name}","releases_url":"https://api.github.com/repos/s-andringa/brightcontent/releases{/id}","created_at":"2015-01-08T07:58:04Z","updated_at":"2015-01-08T07:58:05Z","pushed_at":"2015-01-09T13:18:34Z","git_url":"git://github.com/s-andringa/brightcontent.git","ssh_url":"git@github.com:s-andringa/brightcontent.git","clone_url":"https://github.com/s-andringa/brightcontent.git","svn_url":"https://github.com/s-andringa/brightcontent","homepage":"brightin.nl","size":2247,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"brightin:master","ref":"master","sha":"d5d0a8c332a185894f52b9f1d2c83cc9e230e24c","user":{"login":"brightin","id":317225,"avatar_url":"https://avatars.githubusercontent.com/u/317225?v=3","gravatar_id":"","url":"https://api.github.com/users/brightin","html_url":"https://github.com/brightin","followers_url":"https://api.github.com/users/brightin/followers","following_url":"https://api.github.com/users/brightin/following{/other_user}","gists_url":"https://api.github.com/users/brightin/gists{/gist_id}","starred_url":"https://api.github.com/users/brightin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brightin/subscriptions","organizations_url":"https://api.github.com/users/brightin/orgs","repos_url":"https://api.github.com/users/brightin/repos","events_url":"https://api.github.com/users/brightin/events{/privacy}","received_events_url":"https://api.github.com/users/brightin/received_events","type":"Organization","site_admin":false},"repo":{"id":746446,"name":"brightcontent","full_name":"brightin/brightcontent","owner":{"login":"brightin","id":317225,"avatar_url":"https://avatars.githubusercontent.com/u/317225?v=3","gravatar_id":"","url":"https://api.github.com/users/brightin","html_url":"https://github.com/brightin","followers_url":"https://api.github.com/users/brightin/followers","following_url":"https://api.github.com/users/brightin/following{/other_user}","gists_url":"https://api.github.com/users/brightin/gists{/gist_id}","starred_url":"https://api.github.com/users/brightin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brightin/subscriptions","organizations_url":"https://api.github.com/users/brightin/orgs","repos_url":"https://api.github.com/users/brightin/repos","events_url":"https://api.github.com/users/brightin/events{/privacy}","received_events_url":"https://api.github.com/users/brightin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/brightin/brightcontent","description":"BrightContent, yet another cms / admin panel for Rails","fork":false,"url":"https://api.github.com/repos/brightin/brightcontent","forks_url":"https://api.github.com/repos/brightin/brightcontent/forks","keys_url":"https://api.github.com/repos/brightin/brightcontent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brightin/brightcontent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brightin/brightcontent/teams","hooks_url":"https://api.github.com/repos/brightin/brightcontent/hooks","issue_events_url":"https://api.github.com/repos/brightin/brightcontent/issues/events{/number}","events_url":"https://api.github.com/repos/brightin/brightcontent/events","assignees_url":"https://api.github.com/repos/brightin/brightcontent/assignees{/user}","branches_url":"https://api.github.com/repos/brightin/brightcontent/branches{/branch}","tags_url":"https://api.github.com/repos/brightin/brightcontent/tags","blobs_url":"https://api.github.com/repos/brightin/brightcontent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brightin/brightcontent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brightin/brightcontent/git/refs{/sha}","trees_url":"https://api.github.com/repos/brightin/brightcontent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brightin/brightcontent/statuses/{sha}","languages_url":"https://api.github.com/repos/brightin/brightcontent/languages","stargazers_url":"https://api.github.com/repos/brightin/brightcontent/stargazers","contributors_url":"https://api.github.com/repos/brightin/brightcontent/contributors","subscribers_url":"https://api.github.com/repos/brightin/brightcontent/subscribers","subscription_url":"https://api.github.com/repos/brightin/brightcontent/subscription","commits_url":"https://api.github.com/repos/brightin/brightcontent/commits{/sha}","git_commits_url":"https://api.github.com/repos/brightin/brightcontent/git/commits{/sha}","comments_url":"https://api.github.com/repos/brightin/brightcontent/comments{/number}","issue_comment_url":"https://api.github.com/repos/brightin/brightcontent/issues/comments/{number}","contents_url":"https://api.github.com/repos/brightin/brightcontent/contents/{+path}","compare_url":"https://api.github.com/repos/brightin/brightcontent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brightin/brightcontent/merges","archive_url":"https://api.github.com/repos/brightin/brightcontent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brightin/brightcontent/downloads","issues_url":"https://api.github.com/repos/brightin/brightcontent/issues{/number}","pulls_url":"https://api.github.com/repos/brightin/brightcontent/pulls{/number}","milestones_url":"https://api.github.com/repos/brightin/brightcontent/milestones{/number}","notifications_url":"https://api.github.com/repos/brightin/brightcontent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brightin/brightcontent/labels{/name}","releases_url":"https://api.github.com/repos/brightin/brightcontent/releases{/id}","created_at":"2010-06-29T09:44:54Z","updated_at":"2015-01-09T16:43:36Z","pushed_at":"2015-01-09T16:43:35Z","git_url":"git://github.com/brightin/brightcontent.git","ssh_url":"git@github.com:brightin/brightcontent.git","clone_url":"https://github.com/brightin/brightcontent.git","svn_url":"https://github.com/brightin/brightcontent","homepage":"brightin.nl","size":2247,"stargazers_count":8,"watchers_count":8,"language":"Ruby","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":4,"forks":12,"open_issues":4,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/brightin/brightcontent/pulls/35"},"html":{"href":"https://github.com/brightin/brightcontent/pull/35"},"issue":{"href":"https://api.github.com/repos/brightin/brightcontent/issues/35"},"comments":{"href":"https://api.github.com/repos/brightin/brightcontent/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/brightin/brightcontent/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/brightin/brightcontent/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/brightin/brightcontent/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/brightin/brightcontent/statuses/13d55106893d3adcd3fdd735b2f9d077b27cfe50"}}}}