1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

[ci skip] Improve callback code example for 4.1 upgrade docs.

The previous code example for the new explicit block requirement when
setting callbacks was a little confusing. This commit makes the example
more obvious.
This commit is contained in:
Nick Pellant 2014-07-07 13:24:26 +01:00
parent 489e531334
commit 9c3cb751f0

View file

@ -439,11 +439,11 @@ Rails 4.1 now expects an explicit block to be passed when calling
`ActiveSupport::Callbacks` being largely rewritten for the 4.1 release.
```ruby
# Rails 4.1
set_callback :save, :around, ->(r, block) { stuff; result = block.call; stuff }
# Rails 4.0
# Previously in Rails 4.0
set_callback :save, :around, ->(r, &block) { stuff; result = block.call; stuff }
# Now in Rails 4.1
set_callback :save, :around, ->(r, block) { stuff; result = block.call; stuff }
```
Upgrading from Rails 3.2 to Rails 4.0