diff options
Diffstat (limited to 'activerecord/lib/active_record/relation/predicate_builder.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/predicate_builder.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index 36fc08e6ad..263fdce250 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -10,8 +10,12 @@ module ActiveRecord table = Arel::Table.new(column, default_table.engine) association = klass.reflect_on_association(column.to_sym) - value.each do |k, v| - queries.concat expand(association && association.klass, table, k, v) + if value.empty? + queries.concat ['1 = 2'] + else + value.each do |k, v| + queries.concat expand(association && association.klass, table, k, v) + end end else column = column.to_s |