{"action":"created","comment":{"url":"https://api.github.com/repos/rails/rails/pulls/comments/22403854","id":22403854,"diff_hunk":"@@ -200,13 +200,13 @@ def add_autosave_association_callbacks(reflection)\n             after_create save_method\n             after_update save_method\n           else\n-            define_non_cyclic_method(save_method) { save_belongs_to_association(reflection) }\n+            define_non_cyclic_method(save_method) { throw(:abort) if save_belongs_to_association(reflection) == false }\n             before_save save_method\n           end\n \n           if reflection.validate? && !method_defined?(validation_method)\n             method = (collection ? :validate_collection_association : :validate_single_association)\n-            define_non_cyclic_method(validation_method) { send(method, reflection) }\n+            define_non_cyclic_method(validation_method) { send(method, reflection) || nil }","path":"activerecord/lib/active_record/autosave_association.rb","position":12,"original_position":12,"commit_id":"f65ecbad21031ba1b17914f2b700e7477222cab3","original_commit_id":"f65ecbad21031ba1b17914f2b700e7477222cab3","user":{"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},"body":"Yes, but since it will not generate rdoc we can use markdown.","created_at":"2015-01-02T03:08:09Z","updated_at":"2015-01-02T03:08:09Z","html_url":"https://github.com/rails/rails/pull/17227#discussion_r22403854","pull_request_url":"https://api.github.com/repos/rails/rails/pulls/17227","_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/22403854"},"html":{"href":"https://github.com/rails/rails/pull/17227#discussion_r22403854"},"pull_request":{"href":"https://api.github.com/repos/rails/rails/pulls/17227"}}},"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/17227","id":22542315,"html_url":"https://github.com/rails/rails/pull/17227","diff_url":"https://github.com/rails/rails/pull/17227.diff","patch_url":"https://github.com/rails/rails/pull/17227.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/17227","number":17227,"state":"open","locked":false,"title":"Introduce explicit way of halting callback chains by throwing :abort. Deprecate current implicit behavior of halting callback chains by returning `false` in apps ported to Rails 5.0. Completely remove that behavior in brand new Rails 5.0 apps.","user":{"login":"claudiob","id":10076,"avatar_url":"https://avatars.githubusercontent.com/u/10076?v=3","gravatar_id":"","url":"https://api.github.com/users/claudiob","html_url":"https://github.com/claudiob","followers_url":"https://api.github.com/users/claudiob/followers","following_url":"https://api.github.com/users/claudiob/following{/other_user}","gists_url":"https://api.github.com/users/claudiob/gists{/gist_id}","starred_url":"https://api.github.com/users/claudiob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/claudiob/subscriptions","organizations_url":"https://api.github.com/users/claudiob/orgs","repos_url":"https://api.github.com/users/claudiob/repos","events_url":"https://api.github.com/users/claudiob/events{/privacy}","received_events_url":"https://api.github.com/users/claudiob/received_events","type":"User","site_admin":false},"body":"Stems from discussion with @dhh at https://groups.google.com/forum/#!topic/rubyonrails-core/mhD4T90g0G4\r\n\r\n@dhh – I created this work-in-progress PR to continue the conversation with some code.\r\nCould you tell me if this is what you intended by using `:throw` with a symbol?\r\n\r\nI have quite clear how to add the `throw` to the code in ActiveJob, but not as\r\nmuch where to `catch` it in ActiveSupport. For now I have this code:\r\n\r\n```ruby\r\ndef run_callbacks(kind, &block)\r\n  catch(:abort_job)  do\r\n    send \"run_#{kind}_callbacks\", &block\r\n  end\r\nend\r\n```\r\n\r\nbut maybe the `catch` is better located somewhere at a deeper level of the callback stack.\r\n\r\n@dhh Thoughts? Once I have a clearer idea on how to proceed, I can complete\r\nthis PR with tests, documentations, etc. Thanks!","created_at":"2014-10-10T06:35:51Z","updated_at":"2015-01-02T03:08:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cd1d6dd168e6aea02d9e52598f44a8b3fe7ce7d3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rails/rails/pulls/17227/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/17227/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rails/rails/issues/17227/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/f65ecbad21031ba1b17914f2b700e7477222cab3","head":{"label":"claudiob:explicitly-abort-callbacks","ref":"explicitly-abort-callbacks","sha":"f65ecbad21031ba1b17914f2b700e7477222cab3","user":{"login":"claudiob","id":10076,"avatar_url":"https://avatars.githubusercontent.com/u/10076?v=3","gravatar_id":"","url":"https://api.github.com/users/claudiob","html_url":"https://github.com/claudiob","followers_url":"https://api.github.com/users/claudiob/followers","following_url":"https://api.github.com/users/claudiob/following{/other_user}","gists_url":"https://api.github.com/users/claudiob/gists{/gist_id}","starred_url":"https://api.github.com/users/claudiob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/claudiob/subscriptions","organizations_url":"https://api.github.com/users/claudiob/orgs","repos_url":"https://api.github.com/users/claudiob/repos","events_url":"https://api.github.com/users/claudiob/events{/privacy}","received_events_url":"https://api.github.com/users/claudiob/received_events","type":"User","site_admin":false},"repo":{"id":3272669,"name":"rails","full_name":"claudiob/rails","owner":{"login":"claudiob","id":10076,"avatar_url":"https://avatars.githubusercontent.com/u/10076?v=3","gravatar_id":"","url":"https://api.github.com/users/claudiob","html_url":"https://github.com/claudiob","followers_url":"https://api.github.com/users/claudiob/followers","following_url":"https://api.github.com/users/claudiob/following{/other_user}","gists_url":"https://api.github.com/users/claudiob/gists{/gist_id}","starred_url":"https://api.github.com/users/claudiob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/claudiob/subscriptions","organizations_url":"https://api.github.com/users/claudiob/orgs","repos_url":"https://api.github.com/users/claudiob/repos","events_url":"https://api.github.com/users/claudiob/events{/privacy}","received_events_url":"https://api.github.com/users/claudiob/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/claudiob/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/claudiob/rails","forks_url":"https://api.github.com/repos/claudiob/rails/forks","keys_url":"https://api.github.com/repos/claudiob/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/claudiob/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/claudiob/rails/teams","hooks_url":"https://api.github.com/repos/claudiob/rails/hooks","issue_events_url":"https://api.github.com/repos/claudiob/rails/issues/events{/number}","events_url":"https://api.github.com/repos/claudiob/rails/events","assignees_url":"https://api.github.com/repos/claudiob/rails/assignees{/user}","branches_url":"https://api.github.com/repos/claudiob/rails/branches{/branch}","tags_url":"https://api.github.com/repos/claudiob/rails/tags","blobs_url":"https://api.github.com/repos/claudiob/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/claudiob/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/claudiob/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/claudiob/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/claudiob/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/claudiob/rails/languages","stargazers_url":"https://api.github.com/repos/claudiob/rails/stargazers","contributors_url":"https://api.github.com/repos/claudiob/rails/contributors","subscribers_url":"https://api.github.com/repos/claudiob/rails/subscribers","subscription_url":"https://api.github.com/repos/claudiob/rails/subscription","commits_url":"https://api.github.com/repos/claudiob/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/claudiob/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/claudiob/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/claudiob/rails/issues/comments/{number}","contents_url":"https://api.github.com/repos/claudiob/rails/contents/{+path}","compare_url":"https://api.github.com/repos/claudiob/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/claudiob/rails/merges","archive_url":"https://api.github.com/repos/claudiob/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/claudiob/rails/downloads","issues_url":"https://api.github.com/repos/claudiob/rails/issues{/number}","pulls_url":"https://api.github.com/repos/claudiob/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/claudiob/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/claudiob/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/claudiob/rails/labels{/name}","releases_url":"https://api.github.com/repos/claudiob/rails/releases{/id}","created_at":"2012-01-26T09:52:30Z","updated_at":"2014-11-20T19:18:52Z","pushed_at":"2015-01-02T03:06:55Z","git_url":"git://github.com/claudiob/rails.git","ssh_url":"git@github.com:claudiob/rails.git","clone_url":"https://github.com/claudiob/rails.git","svn_url":"https://github.com/claudiob/rails","homepage":"http://rubyonrails.org","size":123847,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"base":{"label":"rails:master","ref":"master","sha":"d08dc3795924b58a79d58358697df16602da9110","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-02T02:52:58Z","pushed_at":"2015-01-02T02:52:58Z","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":369653,"stargazers_count":24462,"watchers_count":24462,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":9429,"mirror_url":null,"open_issues_count":776,"forks":9429,"open_issues":776,"watchers":24462,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/17227"},"html":{"href":"https://github.com/rails/rails/pull/17227"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/17227"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/17227/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/17227/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/17227/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/f65ecbad21031ba1b17914f2b700e7477222cab3"}}}}