Permalink
Browse files

push up `select` exclusion

  • Loading branch information...
1 parent 5e4031e commit 7fe6d2450695fdd8c2597acca404b7724ec48507 @tenderlove tenderlove committed Oct 13, 2013
@@ -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

0 comments on commit 7fe6d24

Please sign in to comment.