{"action":"created","comment":{"url":"https://api.github.com/repos/rails/rails/pulls/comments/23977032","id":23977032,"diff_hunk":"@@ -893,7 +896,11 @@ def build_arel\n \n       build_select(arel)\n \n-      arel.distinct(distinct_value)\n+      if ((distinct_value.is_a? TrueClass) || (distinct_value.is_a? FalseClass) || distinct_value.nil?)\n+        arel.distinct(distinct_value)\n+      else\n+        arel.distinct_on(Arel.sql(distinct_value))","path":"activerecord/lib/active_record/relation/query_methods.rb","position":18,"original_position":18,"commit_id":"8da033851eca75f96a80b1bab4d7041f9b8805cc","original_commit_id":"8da033851eca75f96a80b1bab4d7041f9b8805cc","user":{"login":"sgrif","id":1529387,"avatar_url":"https://avatars.githubusercontent.com/u/1529387?v=3","gravatar_id":"","url":"https://api.github.com/users/sgrif","html_url":"https://github.com/sgrif","followers_url":"https://api.github.com/users/sgrif/followers","following_url":"https://api.github.com/users/sgrif/following{/other_user}","gists_url":"https://api.github.com/users/sgrif/gists{/gist_id}","starred_url":"https://api.github.com/users/sgrif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgrif/subscriptions","organizations_url":"https://api.github.com/users/sgrif/orgs","repos_url":"https://api.github.com/users/sgrif/repos","events_url":"https://api.github.com/users/sgrif/events{/privacy}","received_events_url":"https://api.github.com/users/sgrif/received_events","type":"User","site_admin":false},"body":"I'd flip this conditional around, and go with this path when given a symbol.","created_at":"2015-02-03T01:54:50Z","updated_at":"2015-02-03T01:54:50Z","html_url":"https://github.com/rails/rails/pull/18773#discussion_r23977032","pull_request_url":"https://api.github.com/repos/rails/rails/pulls/18773","_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/23977032"},"html":{"href":"https://github.com/rails/rails/pull/18773#discussion_r23977032"},"pull_request":{"href":"https://api.github.com/repos/rails/rails/pulls/18773"}}},"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/18773","id":28436407,"html_url":"https://github.com/rails/rails/pull/18773","diff_url":"https://github.com/rails/rails/pull/18773.diff","patch_url":"https://github.com/rails/rails/pull/18773.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/18773","number":18773,"state":"open","locked":false,"title":"Changed distinct method to use column names as inputs #17706","user":{"login":"indaso","id":4015923,"avatar_url":"https://avatars.githubusercontent.com/u/4015923?v=3","gravatar_id":"","url":"https://api.github.com/users/indaso","html_url":"https://github.com/indaso","followers_url":"https://api.github.com/users/indaso/followers","following_url":"https://api.github.com/users/indaso/following{/other_user}","gists_url":"https://api.github.com/users/indaso/gists{/gist_id}","starred_url":"https://api.github.com/users/indaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indaso/subscriptions","organizations_url":"https://api.github.com/users/indaso/orgs","repos_url":"https://api.github.com/users/indaso/repos","events_url":"https://api.github.com/users/indaso/events{/privacy}","received_events_url":"https://api.github.com/users/indaso/received_events","type":"User","site_admin":false},"body":"The distinct method now takes in column names for selecting all rows in distinct records. This should solve #17706 .\r\n\r\nExample: Events.distinct(:id) => \"Select Distinct ON ( id) * From Events\"","created_at":"2015-02-01T20:19:20Z","updated_at":"2015-02-03T01:54:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f2474f7f8720c083eff979c374e1a55dfc1b3d63","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rails/rails/pulls/18773/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/18773/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rails/rails/issues/18773/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/8da033851eca75f96a80b1bab4d7041f9b8805cc","head":{"label":"indaso:railstest-squashed","ref":"railstest-squashed","sha":"8da033851eca75f96a80b1bab4d7041f9b8805cc","user":{"login":"indaso","id":4015923,"avatar_url":"https://avatars.githubusercontent.com/u/4015923?v=3","gravatar_id":"","url":"https://api.github.com/users/indaso","html_url":"https://github.com/indaso","followers_url":"https://api.github.com/users/indaso/followers","following_url":"https://api.github.com/users/indaso/following{/other_user}","gists_url":"https://api.github.com/users/indaso/gists{/gist_id}","starred_url":"https://api.github.com/users/indaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indaso/subscriptions","organizations_url":"https://api.github.com/users/indaso/orgs","repos_url":"https://api.github.com/users/indaso/repos","events_url":"https://api.github.com/users/indaso/events{/privacy}","received_events_url":"https://api.github.com/users/indaso/received_events","type":"User","site_admin":false},"repo":{"id":30156516,"name":"rails","full_name":"indaso/rails","owner":{"login":"indaso","id":4015923,"avatar_url":"https://avatars.githubusercontent.com/u/4015923?v=3","gravatar_id":"","url":"https://api.github.com/users/indaso","html_url":"https://github.com/indaso","followers_url":"https://api.github.com/users/indaso/followers","following_url":"https://api.github.com/users/indaso/following{/other_user}","gists_url":"https://api.github.com/users/indaso/gists{/gist_id}","starred_url":"https://api.github.com/users/indaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indaso/subscriptions","organizations_url":"https://api.github.com/users/indaso/orgs","repos_url":"https://api.github.com/users/indaso/repos","events_url":"https://api.github.com/users/indaso/events{/privacy}","received_events_url":"https://api.github.com/users/indaso/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/indaso/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/indaso/rails","forks_url":"https://api.github.com/repos/indaso/rails/forks","keys_url":"https://api.github.com/repos/indaso/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/indaso/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/indaso/rails/teams","hooks_url":"https://api.github.com/repos/indaso/rails/hooks","issue_events_url":"https://api.github.com/repos/indaso/rails/issues/events{/number}","events_url":"https://api.github.com/repos/indaso/rails/events","assignees_url":"https://api.github.com/repos/indaso/rails/assignees{/user}","branches_url":"https://api.github.com/repos/indaso/rails/branches{/branch}","tags_url":"https://api.github.com/repos/indaso/rails/tags","blobs_url":"https://api.github.com/repos/indaso/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/indaso/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/indaso/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/indaso/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/indaso/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/indaso/rails/languages","stargazers_url":"https://api.github.com/repos/indaso/rails/stargazers","contributors_url":"https://api.github.com/repos/indaso/rails/contributors","subscribers_url":"https://api.github.com/repos/indaso/rails/subscribers","subscription_url":"https://api.github.com/repos/indaso/rails/subscription","commits_url":"https://api.github.com/repos/indaso/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/indaso/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/indaso/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/indaso/rails/issues/comments/{number}","contents_url":"https://api.github.com/repos/indaso/rails/contents/{+path}","compare_url":"https://api.github.com/repos/indaso/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/indaso/rails/merges","archive_url":"https://api.github.com/repos/indaso/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/indaso/rails/downloads","issues_url":"https://api.github.com/repos/indaso/rails/issues{/number}","pulls_url":"https://api.github.com/repos/indaso/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/indaso/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/indaso/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/indaso/rails/labels{/name}","releases_url":"https://api.github.com/repos/indaso/rails/releases{/id}","created_at":"2015-02-01T19:16:38Z","updated_at":"2015-02-01T19:17:02Z","pushed_at":"2015-02-01T20:16:07Z","git_url":"git://github.com/indaso/rails.git","ssh_url":"git@github.com:indaso/rails.git","clone_url":"https://github.com/indaso/rails.git","svn_url":"https://github.com/indaso/rails","homepage":"http://rubyonrails.org","size":128209,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"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":"rails:master","ref":"master","sha":"2fe954ec803efe6b8f3b08541070f9e6a8c71232","user":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"repo":{"id":8514,"name":"rails","full_name":"rails/rails","owner":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rails/rails","description":"Ruby on Rails","fork":false,"url":"https://api.github.com/repos/rails/rails","forks_url":"https://api.github.com/repos/rails/rails/forks","keys_url":"https://api.github.com/repos/rails/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rails/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rails/rails/teams","hooks_url":"https://api.github.com/repos/rails/rails/hooks","issue_events_url":"https://api.github.com/repos/rails/rails/issues/events{/number}","events_url":"https://api.github.com/repos/rails/rails/events","assignees_url":"https://api.github.com/repos/rails/rails/assignees{/user}","branches_url":"https://api.github.com/repos/rails/rails/branches{/branch}","tags_url":"https://api.github.com/repos/rails/rails/tags","blobs_url":"https://api.github.com/repos/rails/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rails/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rails/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/rails/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rails/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/rails/rails/languages","stargazers_url":"https://api.github.com/repos/rails/rails/stargazers","contributors_url":"https://api.github.com/repos/rails/rails/contributors","subscribers_url":"https://api.github.com/repos/rails/rails/subscribers","subscription_url":"https://api.github.com/repos/rails/rails/subscription","commits_url":"https://api.github.com/repos/rails/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/rails/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/rails/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/rails/rails/issues/comments/{number}","contents_url":"https://api.github.com/repos/rails/rails/contents/{+path}","compare_url":"https://api.github.com/repos/rails/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rails/rails/merges","archive_url":"https://api.github.com/repos/rails/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rails/rails/downloads","issues_url":"https://api.github.com/repos/rails/rails/issues{/number}","pulls_url":"https://api.github.com/repos/rails/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/rails/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/rails/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rails/rails/labels{/name}","releases_url":"https://api.github.com/repos/rails/rails/releases{/id}","created_at":"2008-04-11T02:19:47Z","updated_at":"2015-02-03T01:46:22Z","pushed_at":"2015-02-03T01:44:26Z","git_url":"git://github.com/rails/rails.git","ssh_url":"git@github.com:rails/rails.git","clone_url":"https://github.com/rails/rails.git","svn_url":"https://github.com/rails/rails","homepage":"http://rubyonrails.org","size":367955,"stargazers_count":24786,"watchers_count":24786,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":9645,"mirror_url":null,"open_issues_count":766,"forks":9645,"open_issues":766,"watchers":24786,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/18773"},"html":{"href":"https://github.com/rails/rails/pull/18773"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/18773"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/18773/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/18773/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/18773/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/8da033851eca75f96a80b1bab4d7041f9b8805cc"}}}}