diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation/spawn_methods.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index f857e50dea..b4da8e4d1b 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -22,8 +22,10 @@ module ActiveRecord merged_wheres = @where_values r.where_values.each do |w| - if w.is_a?(Arel::Predicates::Equality) - merged_wheres = merged_wheres.reject {|p| p.is_a?(Arel::Predicates::Equality) && p.operand1.name == w.operand1.name } + if w.respond_to?(:operator) && w.operator == :== + merged_wheres = merged_wheres.reject { |p| + p.respond_to?(:operator) && p.operator == :== && p.operand1.name == w.operand1.name + } end merged_wheres += [w] |