提交 7fe6d245 编写于 作者: A Aaron Patterson

push up `select` exclusion

上级 5e4031ef
......@@ -508,7 +508,8 @@ def to_sql
if eager_loading?
join_dependency = construct_join_dependency
relation = construct_relation_for_association_find(join_dependency)
relation = except :select
relation = construct_relation_for_association_find(join_dependency, relation)
end
ast = relation.arel.ast
......
......@@ -242,7 +242,8 @@ def raise_record_not_found_exception!(ids, result_size, expected_size) #:nodoc:
def find_with_associations
join_dependency = construct_join_dependency
relation = construct_relation_for_association_find(join_dependency)
relation = except :select
relation = construct_relation_for_association_find(join_dependency, relation)
if ActiveRecord::NullRelation === relation
[]
else
......@@ -260,8 +261,8 @@ def construct_relation_for_association_calculations
apply_join_dependency(self, construct_join_dependency(arel.froms.first))
end
def construct_relation_for_association_find(join_dependency)
relation = except(:select).select(join_dependency.columns)
def construct_relation_for_association_find(join_dependency, relation = self)
relation = relation.select(join_dependency.columns)
apply_join_dependency(relation, join_dependency)
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册