{"action":"created","comment":{"url":"https://api.github.com/repos/rails/rails/pulls/comments/22532331","id":22532331,"diff_hunk":"@@ -49,8 +49,18 @@ def new(*args, &block)\n         if abstract_class? || self == Base\n           raise NotImplementedError, \"#{self} is an abstract class and cannot be instantiated.\"\n         end\n+        \n+        args_hash = args.first\n+        where_hash = self.current_scope.try(:where_values_hash)\n+\n+        if args_hash.nil? && !where_hash.nil?\n+          attrs = where_hash\n+        elsif where_hash.nil? && !args_hash.nil?\n+          attrs = args_hash\n+        else\n+          attrs = args_hash.try(:merge, where_hash)","path":"activerecord/lib/active_record/inheritance.rb","position":20,"original_position":20,"commit_id":"bce7a6713adc530619c77945a9b3475ab4983f77","original_commit_id":"bce7a6713adc530619c77945a9b3475ab4983f77","user":{"login":"kuldeepaggarwal","id":1930730,"avatar_url":"https://avatars.githubusercontent.com/u/1930730?v=3","gravatar_id":"","url":"https://api.github.com/users/kuldeepaggarwal","html_url":"https://github.com/kuldeepaggarwal","followers_url":"https://api.github.com/users/kuldeepaggarwal/followers","following_url":"https://api.github.com/users/kuldeepaggarwal/following{/other_user}","gists_url":"https://api.github.com/users/kuldeepaggarwal/gists{/gist_id}","starred_url":"https://api.github.com/users/kuldeepaggarwal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuldeepaggarwal/subscriptions","organizations_url":"https://api.github.com/users/kuldeepaggarwal/orgs","repos_url":"https://api.github.com/users/kuldeepaggarwal/repos","events_url":"https://api.github.com/users/kuldeepaggarwal/events{/privacy}","received_events_url":"https://api.github.com/users/kuldeepaggarwal/received_events","type":"User","site_admin":false},"body":"What if both(`args_hash ` and `where_hash `) are nil?","created_at":"2015-01-06T16:31:03Z","updated_at":"2015-01-06T16:31:03Z","html_url":"https://github.com/rails/rails/pull/18227#discussion_r22532331","pull_request_url":"https://api.github.com/repos/rails/rails/pulls/18227","_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/22532331"},"html":{"href":"https://github.com/rails/rails/pull/18227#discussion_r22532331"},"pull_request":{"href":"https://api.github.com/repos/rails/rails/pulls/18227"}}},"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/18227","id":26621745,"html_url":"https://github.com/rails/rails/pull/18227","diff_url":"https://github.com/rails/rails/pull/18227.diff","patch_url":"https://github.com/rails/rails/pull/18227.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/18227","number":18227,"state":"open","locked":false,"title":"Fix #18062 where with build make the inheritance object instead of paren...","user":{"login":"rajcybage","id":3119321,"avatar_url":"https://avatars.githubusercontent.com/u/3119321?v=3","gravatar_id":"","url":"https://api.github.com/users/rajcybage","html_url":"https://github.com/rajcybage","followers_url":"https://api.github.com/users/rajcybage/followers","following_url":"https://api.github.com/users/rajcybage/following{/other_user}","gists_url":"https://api.github.com/users/rajcybage/gists{/gist_id}","starred_url":"https://api.github.com/users/rajcybage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rajcybage/subscriptions","organizations_url":"https://api.github.com/users/rajcybage/orgs","repos_url":"https://api.github.com/users/rajcybage/repos","events_url":"https://api.github.com/users/rajcybage/events{/privacy}","received_events_url":"https://api.github.com/users/rajcybage/received_events","type":"User","site_admin":false},"body":"Fix #18062 \r\n\r\n\r\n","created_at":"2014-12-28T07:57:40Z","updated_at":"2015-01-06T16:31:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a6dd8416eee9c002196a4087fbd3df54da1428aa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rails/rails/pulls/18227/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/18227/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rails/rails/issues/18227/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/bce7a6713adc530619c77945a9b3475ab4983f77","head":{"label":"rajcybage:fix_inheritance_where","ref":"fix_inheritance_where","sha":"bce7a6713adc530619c77945a9b3475ab4983f77","user":{"login":"rajcybage","id":3119321,"avatar_url":"https://avatars.githubusercontent.com/u/3119321?v=3","gravatar_id":"","url":"https://api.github.com/users/rajcybage","html_url":"https://github.com/rajcybage","followers_url":"https://api.github.com/users/rajcybage/followers","following_url":"https://api.github.com/users/rajcybage/following{/other_user}","gists_url":"https://api.github.com/users/rajcybage/gists{/gist_id}","starred_url":"https://api.github.com/users/rajcybage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rajcybage/subscriptions","organizations_url":"https://api.github.com/users/rajcybage/orgs","repos_url":"https://api.github.com/users/rajcybage/repos","events_url":"https://api.github.com/users/rajcybage/events{/privacy}","received_events_url":"https://api.github.com/users/rajcybage/received_events","type":"User","site_admin":false},"repo":{"id":12482297,"name":"rails","full_name":"rajcybage/rails","owner":{"login":"rajcybage","id":3119321,"avatar_url":"https://avatars.githubusercontent.com/u/3119321?v=3","gravatar_id":"","url":"https://api.github.com/users/rajcybage","html_url":"https://github.com/rajcybage","followers_url":"https://api.github.com/users/rajcybage/followers","following_url":"https://api.github.com/users/rajcybage/following{/other_user}","gists_url":"https://api.github.com/users/rajcybage/gists{/gist_id}","starred_url":"https://api.github.com/users/rajcybage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rajcybage/subscriptions","organizations_url":"https://api.github.com/users/rajcybage/orgs","repos_url":"https://api.github.com/users/rajcybage/repos","events_url":"https://api.github.com/users/rajcybage/events{/privacy}","received_events_url":"https://api.github.com/users/rajcybage/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rajcybage/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/rajcybage/rails","forks_url":"https://api.github.com/repos/rajcybage/rails/forks","keys_url":"https://api.github.com/repos/rajcybage/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rajcybage/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rajcybage/rails/teams","hooks_url":"https://api.github.com/repos/rajcybage/rails/hooks","issue_events_url":"https://api.github.com/repos/rajcybage/rails/issues/events{/number}","events_url":"https://api.github.com/repos/rajcybage/rails/events","assignees_url":"https://api.github.com/repos/rajcybage/rails/assignees{/user}","branches_url":"https://api.github.com/repos/rajcybage/rails/branches{/branch}","tags_url":"https://api.github.com/repos/rajcybage/rails/tags","blobs_url":"https://api.github.com/repos/rajcybage/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rajcybage/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rajcybage/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/rajcybage/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rajcybage/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/rajcybage/rails/languages","stargazers_url":"https://api.github.com/repos/rajcybage/rails/stargazers","contributors_url":"https://api.github.com/repos/rajcybage/rails/contributors","subscribers_url":"https://api.github.com/repos/rajcybage/rails/subscribers","subscription_url":"https://api.github.com/repos/rajcybage/rails/subscription","commits_url":"https://api.github.com/repos/rajcybage/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/rajcybage/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/rajcybage/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/rajcybage/rails/issues/comments/{number}","contents_url":"https://api.github.com/repos/rajcybage/rails/contents/{+path}","compare_url":"https://api.github.com/repos/rajcybage/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rajcybage/rails/merges","archive_url":"https://api.github.com/repos/rajcybage/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rajcybage/rails/downloads","issues_url":"https://api.github.com/repos/rajcybage/rails/issues{/number}","pulls_url":"https://api.github.com/repos/rajcybage/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/rajcybage/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/rajcybage/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rajcybage/rails/labels{/name}","releases_url":"https://api.github.com/repos/rajcybage/rails/releases{/id}","created_at":"2013-08-30T08:56:42Z","updated_at":"2014-12-28T07:45:12Z","pushed_at":"2014-12-31T10:22:17Z","git_url":"git://github.com/rajcybage/rails.git","ssh_url":"git@github.com:rajcybage/rails.git","clone_url":"https://github.com/rajcybage/rails.git","svn_url":"https://github.com/rajcybage/rails","homepage":"http://rubyonrails.org","size":119041,"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":"a2108132ed6b55df782eae0fc11149210d5e561d","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-01-06T15:43:20Z","pushed_at":"2015-01-06T16:01:09Z","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":372658,"stargazers_count":24496,"watchers_count":24496,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":9444,"mirror_url":null,"open_issues_count":719,"forks":9444,"open_issues":719,"watchers":24496,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/18227"},"html":{"href":"https://github.com/rails/rails/pull/18227"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/18227"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/18227/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/18227/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/18227/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/bce7a6713adc530619c77945a9b3475ab4983f77"}}}}