diff options
author | Christian Bäuerlein <fabrik42@gmail.com> | 2011-10-14 18:20:41 +0200 |
---|---|---|
committer | Christian Bäuerlein <fabrik42@gmail.com> | 2011-10-14 18:20:41 +0200 |
commit | c6f0461e898601578fa8160608d19fec319067fa (patch) | |
tree | 4de9603d0f57beb70d7374bf46b073e3995731d9 /activerecord/lib/active_record/errors.rb | |
parent | 410fa4cf7c710ff062c59c1c90357729c418be65 (diff) | |
download | rails-c6f0461e898601578fa8160608d19fec319067fa.tar.gz rails-c6f0461e898601578fa8160608d19fec319067fa.tar.bz2 rails-c6f0461e898601578fa8160608d19fec319067fa.zip |
Consider attempted action in exception message of ActiveRecord::StaleObjectError
Diffstat (limited to 'activerecord/lib/active_record/errors.rb')
-rw-r--r-- | activerecord/lib/active_record/errors.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/errors.rb b/activerecord/lib/active_record/errors.rb index 950fc7356c..fc80f3081e 100644 --- a/activerecord/lib/active_record/errors.rb +++ b/activerecord/lib/active_record/errors.rb @@ -99,15 +99,16 @@ module ActiveRecord # # Read more about optimistic locking in ActiveRecord::Locking module RDoc. class StaleObjectError < ActiveRecordError - attr_reader :record + attr_reader :record, :attempted_action - def initialize(record) + def initialize(record, attempted_action) @record = record + @attempted_action = attempted_action end def message - "Attempted to update a stale object: #{record.class.name}" - end + "Attempted to #{attempted_action} a stale object: #{record.class.name}" + end end # Raised when association is being configured improperly or |