{"action":"closed","number":24713,"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/24713","id":67634593,"html_url":"https://github.com/rails/rails/pull/24713","diff_url":"https://github.com/rails/rails/pull/24713.diff","patch_url":"https://github.com/rails/rails/pull/24713.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/24713","number":24713,"state":"closed","locked":false,"title":"Fix counter_cache double increment bug","user":{"login":"tomkadwill","id":907365,"avatar_url":"https://avatars.githubusercontent.com/u/907365?v=3","gravatar_id":"","url":"https://api.github.com/users/tomkadwill","html_url":"https://github.com/tomkadwill","followers_url":"https://api.github.com/users/tomkadwill/followers","following_url":"https://api.github.com/users/tomkadwill/following{/other_user}","gists_url":"https://api.github.com/users/tomkadwill/gists{/gist_id}","starred_url":"https://api.github.com/users/tomkadwill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomkadwill/subscriptions","organizations_url":"https://api.github.com/users/tomkadwill/orgs","repos_url":"https://api.github.com/users/tomkadwill/repos","events_url":"https://api.github.com/users/tomkadwill/events{/privacy}","received_events_url":"https://api.github.com/users/tomkadwill/received_events","type":"User","site_admin":false},"body":"### Summary\r\n\r\nFixes counter cache bug, reported in https://github.com/rails/rails/issues/24183. Counter cache is incrementing twice when replacing the association.\r\n\r\n### Other Information\r\n\r\n- bug can be reproduced with this gist: https://gist.github.com/mikes01/934e7248525e87d1a08c\r\n- @vipulnsward helped me with the fix, here is the gist: https://gist.github.com/vipulnsward/1031bde143ea061be1aa8aa8599f0147","created_at":"2016-04-24T11:25:14Z","updated_at":"2016-05-01T04:48:51Z","closed_at":"2016-05-01T04:48:51Z","merged_at":"2016-05-01T04:48:50Z","merge_commit_sha":"a4b3c78e8619ba84625ceb83118915ef36ec2cfc","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/24713/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/24713/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails/rails/issues/24713/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/c3e3577f9d5058382504773bf0d32afa15cb131e","head":{"label":"tomkadwill:fix_counter_cache_increment","ref":"fix_counter_cache_increment","sha":"c3e3577f9d5058382504773bf0d32afa15cb131e","user":{"login":"tomkadwill","id":907365,"avatar_url":"https://avatars.githubusercontent.com/u/907365?v=3","gravatar_id":"","url":"https://api.github.com/users/tomkadwill","html_url":"https://github.com/tomkadwill","followers_url":"https://api.github.com/users/tomkadwill/followers","following_url":"https://api.github.com/users/tomkadwill/following{/other_user}","gists_url":"https://api.github.com/users/tomkadwill/gists{/gist_id}","starred_url":"https://api.github.com/users/tomkadwill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomkadwill/subscriptions","organizations_url":"https://api.github.com/users/tomkadwill/orgs","repos_url":"https://api.github.com/users/tomkadwill/repos","events_url":"https://api.github.com/users/tomkadwill/events{/privacy}","received_events_url":"https://api.github.com/users/tomkadwill/received_events","type":"User","site_admin":false},"repo":{"id":19341173,"name":"rails","full_name":"tomkadwill/rails","owner":{"login":"tomkadwill","id":907365,"avatar_url":"https://avatars.githubusercontent.com/u/907365?v=3","gravatar_id":"","url":"https://api.github.com/users/tomkadwill","html_url":"https://github.com/tomkadwill","followers_url":"https://api.github.com/users/tomkadwill/followers","following_url":"https://api.github.com/users/tomkadwill/following{/other_user}","gists_url":"https://api.github.com/users/tomkadwill/gists{/gist_id}","starred_url":"https://api.github.com/users/tomkadwill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomkadwill/subscriptions","organizations_url":"https://api.github.com/users/tomkadwill/orgs","repos_url":"https://api.github.com/users/tomkadwill/repos","events_url":"https://api.github.com/users/tomkadwill/events{/privacy}","received_events_url":"https://api.github.com/users/tomkadwill/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tomkadwill/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/tomkadwill/rails","forks_url":"https://api.github.com/repos/tomkadwill/rails/forks","keys_url":"https://api.github.com/repos/tomkadwill/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomkadwill/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomkadwill/rails/teams","hooks_url":"https://api.github.com/repos/tomkadwill/rails/hooks","issue_events_url":"https://api.github.com/repos/tomkadwill/rails/issues/events{/number}","events_url":"https://api.github.com/repos/tomkadwill/rails/events","assignees_url":"https://api.github.com/repos/tomkadwill/rails/assignees{/user}","branches_url":"https://api.github.com/repos/tomkadwill/rails/branches{/branch}","tags_url":"https://api.github.com/repos/tomkadwill/rails/tags","blobs_url":"https://api.github.com/repos/tomkadwill/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomkadwill/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomkadwill/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomkadwill/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomkadwill/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/tomkadwill/rails/languages","stargazers_url":"https://api.github.com/repos/tomkadwill/rails/stargazers","contributors_url":"https://api.github.com/repos/tomkadwill/rails/contributors","subscribers_url":"https://api.github.com/repos/tomkadwill/rails/subscribers","subscription_url":"https://api.github.com/repos/tomkadwill/rails/subscription","commits_url":"https://api.github.com/repos/tomkadwill/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomkadwill/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomkadwill/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomkadwill/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/tomkadwill/rails/contents/{+path}","compare_url":"https://api.github.com/repos/tomkadwill/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomkadwill/rails/merges","archive_url":"https://api.github.com/repos/tomkadwill/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomkadwill/rails/downloads","issues_url":"https://api.github.com/repos/tomkadwill/rails/issues{/number}","pulls_url":"https://api.github.com/repos/tomkadwill/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/tomkadwill/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/tomkadwill/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomkadwill/rails/labels{/name}","releases_url":"https://api.github.com/repos/tomkadwill/rails/releases{/id}","deployments_url":"https://api.github.com/repos/tomkadwill/rails/deployments","created_at":"2014-05-01T09:56:44Z","updated_at":"2016-04-10T11:16:15Z","pushed_at":"2016-04-30T16:42:17Z","git_url":"git://github.com/tomkadwill/rails.git","ssh_url":"git@github.com:tomkadwill/rails.git","clone_url":"https://github.com/tomkadwill/rails.git","svn_url":"https://github.com/tomkadwill/rails","homepage":"http://rubyonrails.org","size":123773,"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":"151080a5f9377e64b85f20e20e449502a5cbc4c3","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}","deployments_url":"https://api.github.com/repos/rails/rails/deployments","created_at":"2008-04-11T02:19:47Z","updated_at":"2016-05-01T03:28:44Z","pushed_at":"2016-05-01T04:48:50Z","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":332549,"stargazers_count":30872,"watchers_count":30872,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12523,"mirror_url":null,"open_issues_count":928,"forks":12523,"open_issues":928,"watchers":30872,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/24713"},"html":{"href":"https://github.com/rails/rails/pull/24713"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/24713"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/24713/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/24713/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/24713/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/c3e3577f9d5058382504773bf0d32afa15cb131e"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"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},"comments":2,"review_comments":2,"commits":1,"additions":14,"deletions":0,"changed_files":3}}