Avoid lambda scopes when possible

Lambda scopes require a bunch more work.  Ideally the `scope` list would
be a homogeneous collection.  In this case, the reflection knows how to
construct the right reflection for this join, so lets just construct
that relation rather than instance execing to figure it out later.
上级 ef7b9b86
......@@ -807,9 +807,7 @@ def scopes
end
def source_type_scope
type = foreign_type
source_type = options[:source_type]
lambda { |object| where(type => source_type) }
through_reflection.klass.where(foreign_type => options[:source_type])
end
def has_scope?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册