提交 c347b3c0 编写于 作者: J Josh Susser

don't change class definition in test case

上级 124c97fb
......@@ -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
......@@ -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'} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册