aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/attribute_methods.rb
diff options
context:
space:
mode:
authorSam Pohlenz <sam@sampohlenz.com>2009-10-07 09:05:54 -0500
committerJoshua Peek <josh@joshpeek.com>2009-10-07 09:07:39 -0500
commitf8e91bda9c171dd0c31dbea95ba4e9ced4ee2547 (patch)
tree35edb91cb5059ac236ef1dbeed5fcc9d4fcf40c3 /activemodel/lib/active_model/attribute_methods.rb
parent3916f0340e8714d36a64162be793192849a9e51f (diff)
downloadrails-f8e91bda9c171dd0c31dbea95ba4e9ced4ee2547.tar.gz
rails-f8e91bda9c171dd0c31dbea95ba4e9ced4ee2547.tar.bz2
rails-f8e91bda9c171dd0c31dbea95ba4e9ced4ee2547.zip
Don't share attribute matchers between classes [#3216 state:resolved]
Allows separate models that include ActiveModel::AttributeMethods to use different sets of attribute matchers. Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'activemodel/lib/active_model/attribute_methods.rb')
-rw-r--r--activemodel/lib/active_model/attribute_methods.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb
index aa35a2726e..26ee9c4315 100644
--- a/activemodel/lib/active_model/attribute_methods.rb
+++ b/activemodel/lib/active_model/attribute_methods.rb
@@ -1,3 +1,6 @@
+require 'active_support/core_ext/hash/keys'
+require 'active_support/core_ext/class/inheritable_attributes'
+
module ActiveModel
class MissingAttributeError < NoMethodError
end
@@ -219,7 +222,7 @@ module ActiveModel
end
def attribute_method_matchers #:nodoc:
- @@attribute_method_matchers ||= []
+ read_inheritable_attribute(:attribute_method_matchers) || write_inheritable_attribute(:attribute_method_matchers, [])
end
end