diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb index 0f750292158d0d8b08831b4893861cd79172c2b7..efe71d1771f0a2f5b3e6cb37f6ec156cfdb0cec3 100644 --- a/activerecord/test/cases/associations_test.rb +++ b/activerecord/test/cases/associations_test.rb @@ -286,12 +286,6 @@ def test_association_methods_override_attribute_methods_of_same_name end def test_model_method_overrides_association_method - Post.class_eval <<-"RUBY" - has_one :first_comment, :class_name => 'Comment', :order => 'id ASC' - def first_comment - super.body - end - RUBY assert_equal(comments(:greetings).body, posts(:welcome).first_comment) end end diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb index 198a963cbc2c86bdc9bdd2a53e9b0b6e5887f419..137cee375281aa191f0006c628c8fcff4e466e75 100644 --- a/activerecord/test/models/post.rb +++ b/activerecord/test/models/post.rb @@ -24,6 +24,10 @@ def greeting belongs_to :author_with_posts, :class_name => "Author", :foreign_key => :author_id, :include => :posts belongs_to :author_with_address, :class_name => "Author", :foreign_key => :author_id, :include => :author_address + def first_comment + super.body + end + has_one :first_comment, :class_name => 'Comment', :order => 'id ASC' has_one :last_comment, :class_name => 'Comment', :order => 'id desc' scope :with_special_comments, :joins => :comments, :conditions => {:comments => {:type => 'SpecialComment'} }