提交 1dcb1ccc 编写于 作者: B Ben Woosley

Simplify conditions within apply_join_dependency

上级 cd04a99b
...@@ -231,16 +231,12 @@ def apply_join_dependency(relation, join_dependency) ...@@ -231,16 +231,12 @@ def apply_join_dependency(relation, join_dependency)
relation = association.join_relation(relation) relation = association.join_relation(relation)
end end
limitable_reflections = using_limitable_reflections?(join_dependency.reflections) if using_limitable_reflections?(join_dependency.reflections)
relation
if !limitable_reflections && relation.limit_value else
limited_id_condition = construct_limited_ids_condition(relation) relation = relation.where(construct_limited_ids_condition(relation)) if relation.limit_value
relation = relation.where(limited_id_condition) relation.except(:limit, :offset)
end end
relation = relation.except(:limit, :offset) unless limitable_reflections
relation
end end
def construct_limited_ids_condition(relation) def construct_limited_ids_condition(relation)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册