From d33dcba72d19beffc4a359f2fb89659f24122e9a Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Tue, 23 Nov 2010 14:58:10 -0500 Subject: Do not send id for quoting twice if the primary key is string. [#6022 state:resolved] --- activerecord/lib/active_record/relation/predicate_builder.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/relation/predicate_builder.rb') diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index 32c7d08daa..7e2ce06dae 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -26,7 +26,8 @@ module ActiveRecord when Range, Arel::Relation attribute.in(value) when ActiveRecord::Base - attribute.eq(value.quoted_id) + sanitized_id = attribute.class == Arel::Attributes::String ? value.id : value.quoted_id + attribute.eq(sanitized_id) when Class # FIXME: I think we need to deprecate this behavior attribute.eq(value.name) -- cgit v1.2.3