aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/core.rb13
-rw-r--r--activerecord/test/cases/inclusion_test.rb4
2 files changed, 13 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb
index b3db41f1d3..8143e31f26 100644
--- a/activerecord/lib/active_record/core.rb
+++ b/activerecord/lib/active_record/core.rb
@@ -62,21 +62,26 @@ module ActiveRecord
Configuration.define :timestamped_migrations, true
included do
-
##
# :singleton-method:
# The connection handler
class_attribute :connection_handler, :instance_writer => false
+
+ initialize_generated_modules
end
module ClassMethods
def inherited(child_class) #:nodoc:
- # force attribute methods to be higher in inheritance hierarchy than other generated methods
- child_class.generated_attribute_methods
- child_class.generated_feature_methods
+ child_class.initialize_generated_modules
super
end
+ def initialize_generated_modules
+ # force attribute methods to be higher in inheritance hierarchy than other generated methods
+ generated_attribute_methods
+ generated_feature_methods
+ end
+
def generated_feature_methods
@generated_feature_methods ||= begin
mod = const_set(:GeneratedFeatureMethods, Module.new)
diff --git a/activerecord/test/cases/inclusion_test.rb b/activerecord/test/cases/inclusion_test.rb
index 2302761205..2e32a6f9ae 100644
--- a/activerecord/test/cases/inclusion_test.rb
+++ b/activerecord/test/cases/inclusion_test.rb
@@ -14,6 +14,10 @@ class BasicInclusionModelTest < ActiveRecord::TestCase
assert_equal "Bob", teapot.name
assert_equal "mmm", teapot.aaahhh
end
+
+ def test_generated_feature_methods
+ assert Teapot < Teapot::GeneratedFeatureMethods
+ end
end
class InclusionUnitTest < ActiveRecord::TestCase