diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-09-05 19:10:21 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-09-05 19:10:21 -0500 |
commit | 6dc9ad80e6ee4a581c5ace005632373fe7275c03 (patch) | |
tree | 03062826db52ad3f435c634f327028a89704cb26 /activemodel/lib/active_model | |
parent | c6e0923245a2e50cd7e1db11741a66569bfd6812 (diff) | |
download | rails-6dc9ad80e6ee4a581c5ace005632373fe7275c03.tar.gz rails-6dc9ad80e6ee4a581c5ace005632373fe7275c03.tar.bz2 rails-6dc9ad80e6ee4a581c5ace005632373fe7275c03.zip |
Fix warnings in AMo
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/attribute_methods.rb | 2 | ||||
-rw-r--r-- | activemodel/lib/active_model/validations_repair_helper.rb | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb index 1091ad3095..aa35a2726e 100644 --- a/activemodel/lib/active_model/attribute_methods.rb +++ b/activemodel/lib/active_model/attribute_methods.rb @@ -181,7 +181,7 @@ module ActiveModel end def attribute_methods_generated? - @attribute_methods_generated ? true : false + @attribute_methods_generated ||= nil end protected diff --git a/activemodel/lib/active_model/validations_repair_helper.rb b/activemodel/lib/active_model/validations_repair_helper.rb index 432e411308..0809e7c0d1 100644 --- a/activemodel/lib/active_model/validations_repair_helper.rb +++ b/activemodel/lib/active_model/validations_repair_helper.rb @@ -7,7 +7,8 @@ module ActiveModel model_classes.inject({}) do |repair, klass| repair[klass] ||= {} [:validate, :validate_on_create, :validate_on_update].each do |callback| - the_callback = klass.instance_variable_get("@#{callback.to_s}_callbacks") + ivar = "@#{callback.to_s}_callbacks" + the_callback = klass.instance_variable_get(ivar) if klass.instance_variable_defined?(ivar) repair[klass][callback] = (the_callback.nil? ? nil : the_callback.dup) end repair |