提交 d95fbd7d 编写于 作者: P pavel

fix initial count

上级 12de5e20
......@@ -33,7 +33,7 @@ def self.initial_count_for(connection, name, table_joins)
elsif join.respond_to? :left
join.left.name == name ? 1 : 0
elsif join.is_a?(Hash)
join[name]
join.fetch(name, 0)
else
# this branch is reached by two tests:
#
......
......@@ -1258,6 +1258,10 @@ def test_has_many_through_with_unscope_should_affect_to_through_scope
assert_equal [comments(:eager_other_comment1)], authors(:mary).unordered_comments
end
def test_has_many_trough_with_scope_should_accept_string_and_hash_join
assert_equal authors(:david), Author.joins({ comments_for_first_author: :post }, "inner join posts posts_alias on authors.id = posts_alias.author_id").eager_load(:categories).take
end
def test_has_many_through_with_scope_should_respect_table_alias
family = Family.create!
users = 3.times.map { User.create! }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册