aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods
diff options
context:
space:
mode:
authorMikel Lindsaar <raasdnil@gmail.com>2010-03-28 14:44:34 +1100
committerMikel Lindsaar <raasdnil@gmail.com>2010-03-28 14:44:34 +1100
commit2bcc2ebf44b59e46c104c92d621e8051c97bfcf5 (patch)
treed2a3f04fd3020c1b5d88847af62d52f2d5e5bd61 /activerecord/lib/active_record/attribute_methods
parentf5774e3e3f70a3acfa559b9ff889e9417fb71d4b (diff)
parent8398f21880a952769ccd6437a4344922fe596dab (diff)
downloadrails-2bcc2ebf44b59e46c104c92d621e8051c97bfcf5.tar.gz
rails-2bcc2ebf44b59e46c104c92d621e8051c97bfcf5.tar.bz2
rails-2bcc2ebf44b59e46c104c92d621e8051c97bfcf5.zip
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r--activerecord/lib/active_record/attribute_methods/dirty.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb
index 4a3ab9ea82..a8698a2f5a 100644
--- a/activerecord/lib/active_record/attribute_methods/dirty.rb
+++ b/activerecord/lib/active_record/attribute_methods/dirty.rb
@@ -18,7 +18,7 @@ module ActiveRecord
def save_with_dirty(*args) #:nodoc:
if status = save_without_dirty(*args)
@previously_changed = changes
- changed_attributes.clear
+ @changed_attributes.clear
end
status
end
@@ -26,16 +26,16 @@ 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 do
- @previously_changed = changes
- changed_attributes.clear
+ @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 do
- previously_changed_attributes.clear
- changed_attributes.clear
+ @previously_changed.clear
+ @changed_attributes.clear
end
end
@@ -45,12 +45,12 @@ module ActiveRecord
attr = attr.to_s
# The attribute already has an unsaved change.
- if changed_attributes.include?(attr)
- old = changed_attributes[attr]
- changed_attributes.delete(attr) unless field_changed?(attr, old, value)
+ if attribute_changed?(attr)
+ old = @changed_attributes[attr]
+ @changed_attributes.delete(attr) unless field_changed?(attr, old, value)
else
old = clone_attribute_value(:read_attribute, attr)
- changed_attributes[attr] = old if field_changed?(attr, old, value)
+ @changed_attributes[attr] = old if field_changed?(attr, old, value)
end
# Carry on.