diff options
-rw-r--r-- | activerecord/lib/active_record/relation/predicate_builder.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index 5cea2328e8..0d1307d87e 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -24,7 +24,9 @@ module ActiveRecord case value when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::Relation - values = value.to_a + values = value.to_a.map { |x| + x.respond_to?(:quoted_id) ? x.quoted_id : x + } attribute.in(values) when Range, Arel::Relation attribute.in(value) |