提交 3f17ed40 编写于 作者: J Jon Leighton 提交者: Aaron Patterson

Test to verify that #2189 (count with has_many :through and a named_scope) is fixed

上级 1619c243
......@@ -529,4 +529,9 @@ def test_select_chosen_fields_only
def test_get_has_many_through_belongs_to_ids_with_conditions
assert_equal [categories(:general).id], authors(:mary).categories_like_general_ids
end
def test_count_has_many_through_with_named_scope
assert_equal 2, authors(:mary).categories.count
assert_equal 1, authors(:mary).categories.general.count
end
end
......@@ -23,6 +23,8 @@ def self.what_are_you
has_many :categorizations
has_many :authors, :through => :categorizations, :select => 'authors.*, categorizations.post_id'
scope :general, :conditions => { :name => 'General' }
end
class SpecialCategory < Category
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册