aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-03-16 15:08:38 -0700
committerwycats <wycats@gmail.com>2010-03-16 15:11:00 -0700
commitdf735cf5b712312a161d703f2606b145ea2d3b85 (patch)
tree02339c72a2f31571bde672d00c8f2f37dfc84f67 /activerecord/lib/active_record/attribute_methods
parent12bf636461e3aab661119ceb3a104cfb70a11666 (diff)
downloadrails-df735cf5b712312a161d703f2606b145ea2d3b85.tar.gz
rails-df735cf5b712312a161d703f2606b145ea2d3b85.tar.bz2
rails-df735cf5b712312a161d703f2606b145ea2d3b85.zip
fisting uninitialized ivar warnings. [#4198 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-rw-r--r--activerecord/lib/active_record/attribute_methods/dirty.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/dirty.rb b/activerecord/lib/active_record/attribute_methods/dirty.rb
index 64e761e7a4..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,8 +26,8 @@ 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
@@ -35,7 +35,7 @@ module ActiveRecord
def reload_with_dirty(*args) #:nodoc:
reload_without_dirty(*args).tap do
@previously_changed.clear
- changed_attributes.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.