aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/attribute_methods
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-09-11 14:48:40 +0100
committerJon Leighton <j@jonathanleighton.com>2011-09-13 00:01:58 +0100
commiteecfa84a9065da2b1bd1e02f37e8653a2825c624 (patch)
tree103ae42eb5c8f6206a5eac7b731307b3348dadb7 /activerecord/test/cases/attribute_methods
parent50d395f96ea05da1e02459688e94bff5872c307b (diff)
downloadrails-eecfa84a9065da2b1bd1e02f37e8653a2825c624.tar.gz
rails-eecfa84a9065da2b1bd1e02f37e8653a2825c624.tar.bz2
rails-eecfa84a9065da2b1bd1e02f37e8653a2825c624.zip
Always generate attribute methods on the base class.
This fixes a situation I encountered where a subclass would cache the name of a generated attribute method in @_defined_class_methods. Then, when the superclass has it's attribute methods undefined, the subclass would always have to dispatch through method_missing, because the presence of the attribute in @_defined_class_methods would mean that it is never generated again, even if undefine_attribute_methods is called on the subclass. There various other confusing edge cases like this. STI classes share columns, so let's just keep all the attribute method generation state isolated to the base class.
Diffstat (limited to 'activerecord/test/cases/attribute_methods')
-rw-r--r--activerecord/test/cases/attribute_methods/read_test.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/test/cases/attribute_methods/read_test.rb b/activerecord/test/cases/attribute_methods/read_test.rb
index 3641031d12..e03ed33591 100644
--- a/activerecord/test/cases/attribute_methods/read_test.rb
+++ b/activerecord/test/cases/attribute_methods/read_test.rb
@@ -35,6 +35,7 @@ module ActiveRecord
end
def self.serialized_attributes; {}; end
+ def self.base_class; self; end
end
end