From d3cfb939e18f98e7b54015dd4d71160f9069e240 Mon Sep 17 00:00:00 2001 From: Marcel Jackwerth Date: Fri, 27 May 2011 23:48:24 +0200 Subject: [PATCH] call .quote_value with column-parameter in patch #1362 --- .../active_record/associations/through_association_scope.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/associations/through_association_scope.rb b/activerecord/lib/active_record/associations/through_association_scope.rb index ef885712f4110..03ee6c67ace63 100644 --- a/activerecord/lib/active_record/associations/through_association_scope.rb +++ b/activerecord/lib/active_record/associations/through_association_scope.rb @@ -30,7 +30,9 @@ def construct_conditions # Associate attributes pointing to owner, quoted. def construct_quoted_owner_attributes(reflection) if as = reflection.options[:as] - { "#{as}_id" => @owner.class.quote_value(@owner[reflection.active_record_primary_key]), + { "#{as}_id" => @owner.class.quote_value( + @owner[reflection.active_record_primary_key], + reflection.klass.columns_hash["#{as}_id"]), "#{as}_type" => reflection.klass.quote_value( @owner.class.base_class.name.to_s, reflection.klass.columns_hash["#{as}_type"]) }