Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

push up `select` exclusion

  • Loading branch information...
commit 7fe6d2450695fdd8c2597acca404b7724ec48507 1 parent 5e4031e
@tenderlove tenderlove authored
View
3  activerecord/lib/active_record/relation.rb
@@ -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
View
7 activerecord/lib/active_record/relation/finder_methods.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.