rails/rails — pull request #17227 by claudiob (2014-10-10 06:35:51+00:00)
Title: Throw :abort_job to exit a callback chain

Stems from discussion with @dhh at https://groups.google.com/forum/#!topic/rubyonrails-core/mhD4T90g0G4

@dhh – I created this work-in-progress PR to continue the conversation with some code.
Could you tell me if this is what you intended by using `:throw` with a symbol?

I have quite clear how to add the `throw` to the code in ActiveJob, but not as
much where to `catch` it in ActiveSupport. For now I have this code:

```ruby
def run_callbacks(kind, &block)
catch(:abort_job) do
send "run_#{kind}_callbacks", &block
end
end
```

but maybe the `catch` is better located somewhere at a deeper level of the callback stack.

@dhh Thoughts? Once I have a clearer idea on how to proceed, I can complete
this PR with tests, documentations, etc. Thanks!