diff options
Diffstat (limited to 'activerecord/lib/active_record/dirty.rb')
-rw-r--r-- | activerecord/lib/active_record/dirty.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/dirty.rb b/activerecord/lib/active_record/dirty.rb index 49f1204fa1..8fdc763292 100644 --- a/activerecord/lib/active_record/dirty.rb +++ b/activerecord/lib/active_record/dirty.rb @@ -40,6 +40,7 @@ module ActiveRecord base.alias_method_chain :save, :dirty base.alias_method_chain :save!, :dirty base.alias_method_chain :update, :dirty + base.alias_method_chain :reload, :dirty base.superclass_delegating_accessor :partial_updates base.partial_updates = false @@ -84,6 +85,13 @@ module ActiveRecord status end + # <tt>reload</tt> the record and clears changed attributes. + def reload_with_dirty(*args) #:nodoc: + record = reload_without_dirty(*args) + changed_attributes.clear + record + end + private # Map of change attr => original value. def changed_attributes |