aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
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 /activemodel
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 'activemodel')
-rw-r--r--activemodel/lib/active_model/dirty.rb17
1 files changed, 7 insertions, 10 deletions
diff --git a/activemodel/lib/active_model/dirty.rb b/activemodel/lib/active_model/dirty.rb
index cb70cf74ee..d3a6bad6bb 100644
--- a/activemodel/lib/active_model/dirty.rb
+++ b/activemodel/lib/active_model/dirty.rb
@@ -91,7 +91,7 @@ module ActiveModel
# person.name = 'bob'
# person.changed? # => true
def changed?
- !changed_attributes.empty?
+ !@changed_attributes.empty?
end
# List of attributes with unsaved changes.
@@ -99,7 +99,7 @@ module ActiveModel
# person.name = 'bob'
# person.changed # => ['name']
def changed
- changed_attributes.keys
+ @changed_attributes.keys
end
# Map of changed attrs => [original value, new value].
@@ -120,22 +120,19 @@ module ActiveModel
end
private
- # Map of change <tt>attr => original value</tt>.
- attr_reader :changed_attributes
-
# Handle <tt>*_changed?</tt> for +method_missing+.
def attribute_changed?(attr)
- changed_attributes.include?(attr)
+ @changed_attributes.include?(attr)
end
# Handle <tt>*_change</tt> for +method_missing+.
def attribute_change(attr)
- [changed_attributes[attr], __send__(attr)] if attribute_changed?(attr)
+ [@changed_attributes[attr], __send__(attr)] if attribute_changed?(attr)
end
# Handle <tt>*_was</tt> for +method_missing+.
def attribute_was(attr)
- attribute_changed?(attr) ? changed_attributes[attr] : __send__(attr)
+ attribute_changed?(attr) ? @changed_attributes[attr] : __send__(attr)
end
# Handle <tt>*_will_change!</tt> for +method_missing+.
@@ -146,12 +143,12 @@ module ActiveModel
rescue TypeError, NoMethodError
end
- changed_attributes[attr] = value
+ @changed_attributes[attr] = value
end
# Handle <tt>reset_*!</tt> for +method_missing+.
def reset_attribute!(attr)
- __send__("#{attr}=", changed_attributes[attr]) if attribute_changed?(attr)
+ __send__("#{attr}=", @changed_attributes[attr]) if attribute_changed?(attr)
end
end
end