Skip to content

Commit

Permalink
Ensure attribute methods are included after all the AR stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
jonleighton committed Dec 24, 2011
1 parent 1029c51 commit a1ee3ac
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/attribute_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def generated_external_attribute_methods
end

def undefine_attribute_methods
super
super if attribute_methods_generated?
@attribute_methods_generated = false
end

Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module Core
# The connection handler
class_attribute :connection_handler, :instance_writer => false

initialize_generated_modules
initialize_generated_modules unless self == Base
end

module ClassMethods
Expand Down
1 change: 1 addition & 0 deletions activerecord/test/cases/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def test_generated_methods_modules
assert(modules.index(Computer.generated_attribute_methods) > modules.index(Computer.generated_feature_methods),
"generated_attribute_methods must be higher in inheritance hierarchy than generated_feature_methods")
assert_not_equal Computer.generated_feature_methods, Post.generated_feature_methods
assert(modules.index(Computer.generated_attribute_methods) < modules.index(ActiveRecord::Base.ancestors[1]))
end

def test_column_names_are_escaped
Expand Down

0 comments on commit a1ee3ac

Please sign in to comment.