提交 3c4aa73c 编写于 作者: M Matt Todd 提交者: Arthur Neves

Make inherited scope test fail

This triggers the JoinDependency work to reflect on the associations
and trigger an error as follows:

  ActiveRecord::ConfigurationError: Association named 'account' was
  not found on Company; perhaps you misspelled it?

Fix Company.of_first_firm joins association name

Should be `Company.joins(:accounts)` not `Company.joins(:account)`.

Do the same for Client.of_first_firm
上级 6a25202d
......@@ -352,8 +352,8 @@ def test_inheritance_without_mapping
end
def test_scope_inherited_properly
assert_nothing_raised { Company.of_first_firm }
assert_nothing_raised { Client.of_first_firm }
assert_nothing_raised { Company.of_first_firm.to_sql }
assert_nothing_raised { Client.of_first_firm.to_sql }
end
end
......
......@@ -12,7 +12,7 @@ class Company < AbstractCompany
has_many :developers, :through => :contracts
scope :of_first_firm, lambda {
joins(:account => :firm).
joins(:accounts => :firm).
where('firms.id' => 1)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册