rails/rails — pull request #3331 by fabrik42 (2011-10-14 14:35:40+00:00)
Title: Include affected record when raising an ActiveRecord::StaleObjectError

Hey there,

I added a `record` attribute to the `ActiveRecord::StaleObjectError` exception.
Instead of a string, now the record raising this exception is passed to the constructor.

This becomes pretty handy, for example when you want to reload the `record` before rendering a form again.

Example:

```ruby
rescue_from 'ActiveRecord::StaleObjectError' do |exception|
respond_to do |format|
format.html do
exception.record.reload!
render :action => :edit
end
end
end
```