aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/attribute_methods.rb
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2012-05-20 11:11:20 -0700
committerPiotr Sarnacki <drogus@gmail.com>2012-05-20 11:11:20 -0700
commit08a5b10eb1c750927c05e50f182e070c1321fb81 (patch)
tree82a731d228c75c82f0c56311e188c27bd7f297df /activemodel/lib/active_model/attribute_methods.rb
parent79b38c386ae3817df5321522ab9ea169c028de96 (diff)
downloadrails-08a5b10eb1c750927c05e50f182e070c1321fb81.tar.gz
rails-08a5b10eb1c750927c05e50f182e070c1321fb81.tar.bz2
rails-08a5b10eb1c750927c05e50f182e070c1321fb81.zip
Revert "Merge pull request #5702 from oscardelben/patch-4"
This reverts commit cae1ca7d1be9c79c7ef012a1f62aef9d3bb815f8, reversing changes made to da97cf016a8ffd1f54f804cd881f393e5d6efc18. These changes break the build, it needs more investigation.
Diffstat (limited to 'activemodel/lib/active_model/attribute_methods.rb')
-rw-r--r--activemodel/lib/active_model/attribute_methods.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb
index 039cd8bdf3..99918fdb96 100644
--- a/activemodel/lib/active_model/attribute_methods.rb
+++ b/activemodel/lib/active_model/attribute_methods.rb
@@ -102,6 +102,7 @@ module ActiveModel
# person.name # => nil
def attribute_method_prefix(*prefixes)
self.attribute_method_matchers += prefixes.map { |prefix| AttributeMethodMatcher.new :prefix => prefix }
+ undefine_attribute_methods
end
# Declares a method available for all attributes with the given suffix.
@@ -138,6 +139,7 @@ module ActiveModel
# person.name_short? # => true
def attribute_method_suffix(*suffixes)
self.attribute_method_matchers += suffixes.map { |suffix| AttributeMethodMatcher.new :suffix => suffix }
+ undefine_attribute_methods
end
# Declares a method available for all attributes with the given prefix
@@ -175,6 +177,7 @@ module ActiveModel
# person.name # => 'Gemma'
def attribute_method_affix(*affixes)
self.attribute_method_matchers += affixes.map { |affix| AttributeMethodMatcher.new :prefix => affix[:prefix], :suffix => affix[:suffix] }
+ undefine_attribute_methods
end
@@ -222,7 +225,6 @@ module ActiveModel
# end
# end
def define_attribute_methods(*attr_names)
- undefine_attribute_methods
attr_names.flatten.each { |attr_name| define_attribute_method(attr_name) }
end