提交 fbaae891 编写于 作者: A Aaron Patterson

only calculate the klass once

上级 5304afcb
......@@ -89,10 +89,11 @@ def add_constraints(scope)
scope = scope.joins(join(foreign_table, constraint))
end
klass = i == 0 ? self.klass : reflection.klass
# Exclude the scope of the association itself, because that
# was already merged in the #scope method.
scope_chain[i].each do |scope_chain_item|
klass = i == 0 ? self.klass : reflection.klass
item = eval_scope(klass, scope_chain_item)
if scope_chain_item == self.reflection.scope
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册