{"action":"created","comment":{"url":"https://api.github.com/repos/rails/rails/pulls/comments/25554661","id":25554661,"diff_hunk":"@@ -478,6 +478,14 @@ def test_taking_not_found\n     assert_raise(ActiveRecord::RecordNotFound) { authors(:bob).posts.take! }\n   end\n \n+  def test_taking_with_a_number\n+    assert_equal [posts(:misc_by_bob)], authors(:bob).posts.take(1)\n+    assert_equal [posts(:misc_by_bob), posts(:other_by_bob)], authors(:bob).posts.take(2)\n+    authors(:bob).posts.to_a","path":"activerecord/test/cases/associations/has_many_associations_test.rb","position":null,"original_position":7,"commit_id":"072d8dc2925ddc712eef69aea9781acb35985de3","original_commit_id":"9d9da2122d339a5339ae0d22e108664dcf4f887b","user":{"login":"amatsuda","id":11493,"avatar_url":"https://avatars.githubusercontent.com/u/11493?v=3","gravatar_id":"","url":"https://api.github.com/users/amatsuda","html_url":"https://github.com/amatsuda","followers_url":"https://api.github.com/users/amatsuda/followers","following_url":"https://api.github.com/users/amatsuda/following{/other_user}","gists_url":"https://api.github.com/users/amatsuda/gists{/gist_id}","starred_url":"https://api.github.com/users/amatsuda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amatsuda/subscriptions","organizations_url":"https://api.github.com/users/amatsuda/orgs","repos_url":"https://api.github.com/users/amatsuda/repos","events_url":"https://api.github.com/users/amatsuda/events{/privacy}","received_events_url":"https://api.github.com/users/amatsuda/received_events","type":"User","site_admin":false},"body":"Thanks for the comment. Just made it more comprehensible and `push -f`ed.","created_at":"2015-02-28T05:42:11Z","updated_at":"2015-02-28T05:42:11Z","html_url":"https://github.com/rails/rails/pull/19105#discussion_r25554661","pull_request_url":"https://api.github.com/repos/rails/rails/pulls/19105","_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/25554661"},"html":{"href":"https://github.com/rails/rails/pull/19105#discussion_r25554661"},"pull_request":{"href":"https://api.github.com/repos/rails/rails/pulls/19105"}}},"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/19105","id":30139745,"html_url":"https://github.com/rails/rails/pull/19105","diff_url":"https://github.com/rails/rails/pull/19105.diff","patch_url":"https://github.com/rails/rails/pull/19105.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/19105","number":19105,"state":"open","locked":false,"title":"Preserve Array#take(n) behaviour of HasManyAssociation","user":{"login":"amatsuda","id":11493,"avatar_url":"https://avatars.githubusercontent.com/u/11493?v=3","gravatar_id":"","url":"https://api.github.com/users/amatsuda","html_url":"https://github.com/amatsuda","followers_url":"https://api.github.com/users/amatsuda/followers","following_url":"https://api.github.com/users/amatsuda/following{/other_user}","gists_url":"https://api.github.com/users/amatsuda/gists{/gist_id}","starred_url":"https://api.github.com/users/amatsuda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amatsuda/subscriptions","organizations_url":"https://api.github.com/users/amatsuda/orgs","repos_url":"https://api.github.com/users/amatsuda/repos","events_url":"https://api.github.com/users/amatsuda/events{/privacy}","received_events_url":"https://api.github.com/users/amatsuda/received_events","type":"User","site_admin":false},"body":"I'm not sure whether this behaviour change was by design, so let me PR.\r\n\r\n`take` method with an argument had been available on HasManyAssociation until 2b63a354a8f5960a8c5ed4563fdc0730fd9b6809. It used to fallback to `Array#take(n)`.\r\nBut now `association.take(n)` raises `ArgumentError: wrong number of arguments (1 for 0)`.\r\n\r\nThis patch retrieves `Array#take(n)` behaviour without breaking the AR version of `take`.\r\n\r\nNote that I didn't touch `take!` method because Ruby Array does not have `take!`.\r\nSo `take` can take an argument but `take!` can not take an argument after this change.\r\nI think it's acceptable here, but I'd mention that the API would look a little bit inconsistent.","created_at":"2015-02-27T03:44:12Z","updated_at":"2015-02-28T05:42:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dcade8adc45fc133ca466ec91e33eaacfca143d0","assignee":{"login":"rafaelfranca","id":47848,"avatar_url":"https://avatars.githubusercontent.com/u/47848?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelfranca","html_url":"https://github.com/rafaelfranca","followers_url":"https://api.github.com/users/rafaelfranca/followers","following_url":"https://api.github.com/users/rafaelfranca/following{/other_user}","gists_url":"https://api.github.com/users/rafaelfranca/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelfranca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelfranca/subscriptions","organizations_url":"https://api.github.com/users/rafaelfranca/orgs","repos_url":"https://api.github.com/users/rafaelfranca/repos","events_url":"https://api.github.com/users/rafaelfranca/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelfranca/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/rails/rails/pulls/19105/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/19105/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails/rails/issues/19105/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/072d8dc2925ddc712eef69aea9781acb35985de3","head":{"label":"amatsuda:array_take","ref":"array_take","sha":"072d8dc2925ddc712eef69aea9781acb35985de3","user":{"login":"amatsuda","id":11493,"avatar_url":"https://avatars.githubusercontent.com/u/11493?v=3","gravatar_id":"","url":"https://api.github.com/users/amatsuda","html_url":"https://github.com/amatsuda","followers_url":"https://api.github.com/users/amatsuda/followers","following_url":"https://api.github.com/users/amatsuda/following{/other_user}","gists_url":"https://api.github.com/users/amatsuda/gists{/gist_id}","starred_url":"https://api.github.com/users/amatsuda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amatsuda/subscriptions","organizations_url":"https://api.github.com/users/amatsuda/orgs","repos_url":"https://api.github.com/users/amatsuda/repos","events_url":"https://api.github.com/users/amatsuda/events{/privacy}","received_events_url":"https://api.github.com/users/amatsuda/received_events","type":"User","site_admin":false},"repo":{"id":1449810,"name":"rails","full_name":"amatsuda/rails","owner":{"login":"amatsuda","id":11493,"avatar_url":"https://avatars.githubusercontent.com/u/11493?v=3","gravatar_id":"","url":"https://api.github.com/users/amatsuda","html_url":"https://github.com/amatsuda","followers_url":"https://api.github.com/users/amatsuda/followers","following_url":"https://api.github.com/users/amatsuda/following{/other_user}","gists_url":"https://api.github.com/users/amatsuda/gists{/gist_id}","starred_url":"https://api.github.com/users/amatsuda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amatsuda/subscriptions","organizations_url":"https://api.github.com/users/amatsuda/orgs","repos_url":"https://api.github.com/users/amatsuda/repos","events_url":"https://api.github.com/users/amatsuda/events{/privacy}","received_events_url":"https://api.github.com/users/amatsuda/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amatsuda/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/amatsuda/rails","forks_url":"https://api.github.com/repos/amatsuda/rails/forks","keys_url":"https://api.github.com/repos/amatsuda/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amatsuda/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amatsuda/rails/teams","hooks_url":"https://api.github.com/repos/amatsuda/rails/hooks","issue_events_url":"https://api.github.com/repos/amatsuda/rails/issues/events{/number}","events_url":"https://api.github.com/repos/amatsuda/rails/events","assignees_url":"https://api.github.com/repos/amatsuda/rails/assignees{/user}","branches_url":"https://api.github.com/repos/amatsuda/rails/branches{/branch}","tags_url":"https://api.github.com/repos/amatsuda/rails/tags","blobs_url":"https://api.github.com/repos/amatsuda/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amatsuda/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amatsuda/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/amatsuda/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amatsuda/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/amatsuda/rails/languages","stargazers_url":"https://api.github.com/repos/amatsuda/rails/stargazers","contributors_url":"https://api.github.com/repos/amatsuda/rails/contributors","subscribers_url":"https://api.github.com/repos/amatsuda/rails/subscribers","subscription_url":"https://api.github.com/repos/amatsuda/rails/subscription","commits_url":"https://api.github.com/repos/amatsuda/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/amatsuda/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/amatsuda/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/amatsuda/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/amatsuda/rails/contents/{+path}","compare_url":"https://api.github.com/repos/amatsuda/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amatsuda/rails/merges","archive_url":"https://api.github.com/repos/amatsuda/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amatsuda/rails/downloads","issues_url":"https://api.github.com/repos/amatsuda/rails/issues{/number}","pulls_url":"https://api.github.com/repos/amatsuda/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/amatsuda/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/amatsuda/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amatsuda/rails/labels{/name}","releases_url":"https://api.github.com/repos/amatsuda/rails/releases{/id}","created_at":"2011-03-07T11:51:46Z","updated_at":"2014-10-25T09:02:41Z","pushed_at":"2015-02-28T05:39:31Z","git_url":"git://github.com/amatsuda/rails.git","ssh_url":"git@github.com:amatsuda/rails.git","clone_url":"https://github.com/amatsuda/rails.git","svn_url":"https://github.com/amatsuda/rails","homepage":"http://rubyonrails.org","size":121172,"stargazers_count":7,"watchers_count":7,"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":7,"default_branch":"master"}},"base":{"label":"rails:master","ref":"master","sha":"3458873642182689e835be8643a50b7634c3e0f5","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-28T05:18:52Z","pushed_at":"2015-02-27T21:30:38Z","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":380304,"stargazers_count":25113,"watchers_count":25113,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":9809,"mirror_url":null,"open_issues_count":715,"forks":9809,"open_issues":715,"watchers":25113,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/19105"},"html":{"href":"https://github.com/rails/rails/pull/19105"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/19105"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/19105/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/19105/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/19105/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/072d8dc2925ddc712eef69aea9781acb35985de3"}}}}