diff options
author | Eileen M. Uchitelle <eileencodes@gmail.com> | 2014-07-07 08:33:48 -0400 |
---|---|---|
committer | Eileen M. Uchitelle <eileencodes@gmail.com> | 2014-07-07 08:33:48 -0400 |
commit | 186978821881f56a07df3b16b5ea6bdb629fdc02 (patch) | |
tree | 9b9aeb6c81a121fa318edaae778b0f06c4161968 /guides/source | |
parent | c2d96d14ecf5c8f0103b6539f5bb07b2f9527585 (diff) | |
parent | 9c3cb751f0ebf06d3ee15ae9c6279e49af9ee0e6 (diff) | |
download | rails-186978821881f56a07df3b16b5ea6bdb629fdc02.tar.gz rails-186978821881f56a07df3b16b5ea6bdb629fdc02.tar.bz2 rails-186978821881f56a07df3b16b5ea6bdb629fdc02.zip |
Merge pull request #16086 from nickpellant/master
Add callbacks documentation for upgrading to 4.1.
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/upgrading_ruby_on_rails.md | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 9c67391e8f..1e752b449d 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -432,6 +432,20 @@ symbol access is no longer supported. This is also the case for `store_accessors` based on top of `json` or `hstore` columns. Make sure to use string keys consistently. +### Explicit block use for `ActiveSupport::Callbacks` + +Rails 4.1 now expects an explicit block to be passed when calling +`ActiveSupport::Callbacks.set_callback`. This change stems from +`ActiveSupport::Callbacks` being largely rewritten for the 4.1 release. + +```ruby +# 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 ------------------------------------- |