diff options
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 3b22be78cb..1ed42ffb95 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -319,13 +319,13 @@ module ActiveRecord end def where_values_hash - Hash[@where_values.find_all { |w| - w.respond_to?(:operator) && w.operator == :== && w.left.relation.name == table_name - }.map { |where| - [ - where.left.name, - where.right.respond_to?(:value) ? where.right.value : where.right - ] + equalities = @where_values.grep(Arel::Nodes::Equality).find_all { |node| + node.left.relation.name == table_name + } + + Hash[equalities.map { |where| + left, right = where.left, where.right + [ left.name, right.respond_to?(:value) ? right.value : right ] }] end |