diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-21 10:38:51 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-05-21 10:38:51 -0700 |
commit | d2d5f15f0729d00132a240dd9e5169dce5962a0d (patch) | |
tree | 048197336d19f18122c72713ff019f78ce340b39 | |
parent | a483ae6477fab482e95b3415bb9b0cf54f198699 (diff) | |
download | rails-d2d5f15f0729d00132a240dd9e5169dce5962a0d.tar.gz rails-d2d5f15f0729d00132a240dd9e5169dce5962a0d.tar.bz2 rails-d2d5f15f0729d00132a240dd9e5169dce5962a0d.zip |
push partitioning up so bind elimination can get the removed wheres
-rw-r--r-- | activerecord/lib/active_record/relation/merger.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/relation/merger.rb b/activerecord/lib/active_record/relation/merger.rb index eb72d551da..38f49912d1 100644 --- a/activerecord/lib/active_record/relation/merger.rb +++ b/activerecord/lib/active_record/relation/merger.rb @@ -102,7 +102,9 @@ module ActiveRecord rhs_wheres = values[:where] || [] 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 if values[:reordering] @@ -134,10 +136,6 @@ module ActiveRecord 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 # present in the relation being merged in. # returns [things_to_remove, things_to_keep] |