aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-09-01 15:45:43 -0300
committerEmilio Tagua <miloops@gmail.com>2009-09-01 15:45:43 -0300
commit39e4e76d15233bb1cb0b778d920f54efe86bb4f0 (patch)
tree7e9cab343139c79acc36715f4f24c579a207fbc6 /activerecord/lib/active_record/attribute_methods
parent6b67df70ab1bc42d9a05571144cdf5614a7d4a6a (diff)
parentda636809daca9c338200811d3590e446f57c8e81 (diff)
downloadrails-39e4e76d15233bb1cb0b778d920f54efe86bb4f0.tar.gz
rails-39e4e76d15233bb1cb0b778d920f54efe86bb4f0.tar.bz2
rails-39e4e76d15233bb1cb0b778d920f54efe86bb4f0.zip
Merge commit 'rails/master'
Conflicts: activerecord/lib/active_record/associations.rb
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r--activerecord/lib/active_record/attribute_methods/dirty.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb
index b6c4df2a49..4df0f1af69 100644
--- a/activerecord/lib/active_record/attribute_methods/dirty.rb
+++ b/activerecord/lib/active_record/attribute_methods/dirty.rb
@@ -19,6 +19,7 @@ module ActiveRecord
# Attempts to +save+ the record and clears changed attributes if successful.
def save_with_dirty(*args) #:nodoc:
if status = save_without_dirty(*args)
+ @previously_changed = changes
changed_attributes.clear
end
status
@@ -26,12 +27,18 @@ module ActiveRecord
# Attempts to <tt>save!</tt> the record and clears changed attributes if successful.
def save_with_dirty!(*args) #:nodoc:
- save_without_dirty!(*args).tap { changed_attributes.clear }
+ save_without_dirty!(*args).tap do
+ @previously_changed = changes
+ changed_attributes.clear
+ end
end
# <tt>reload</tt> the record and clears changed attributes.
def reload_with_dirty(*args) #:nodoc:
- reload_without_dirty(*args).tap { changed_attributes.clear }
+ reload_without_dirty(*args).tap do
+ previously_changed_attributes.clear
+ changed_attributes.clear
+ end
end
private