Skip to content

Commit

Permalink
Merge pull request #16086 from nickpellant/master
Browse files Browse the repository at this point in the history
Add callbacks documentation for upgrading to 4.1.
  • Loading branch information
eileencodes committed Jul 7, 2014
2 parents c2d96d1 + 9c3cb75 commit 1869788
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions guides/source/upgrading_ruby_on_rails.md
Expand Up @@ -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
-------------------------------------

Expand Down

0 comments on commit 1869788

Please sign in to comment.