Skip to content

Commit

Permalink
push partitioning up so bind elimination can get the removed wheres
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed May 21, 2013
1 parent a483ae6 commit d2d5f15
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions activerecord/lib/active_record/relation/merger.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ def merge_multi_values
rhs_wheres = values[:where] || [] rhs_wheres = values[:where] || []
lhs_wheres = relation.where_values lhs_wheres = relation.where_values


relation.where_values = merged_wheres(lhs_wheres, rhs_wheres) _, kept = partition_overwrites(lhs_wheres, rhs_wheres)

relation.where_values = kept + rhs_wheres
relation.bind_values = merged_binds relation.bind_values = merged_binds


if values[:reordering] if values[:reordering]
Expand Down Expand Up @@ -134,10 +136,6 @@ def merged_binds
end end
end end


def merged_wheres(lhs_wheres, rhs_wheres)
partition_overwrites(lhs_wheres, rhs_wheres).last + rhs_wheres
end

# Remove equalities from the existing relation with a LHS which is # Remove equalities from the existing relation with a LHS which is
# present in the relation being merged in. # present in the relation being merged in.
# returns [things_to_remove, things_to_keep] # returns [things_to_remove, things_to_keep]
Expand Down

0 comments on commit d2d5f15

Please sign in to comment.