Permalink
Browse files

quoting id columns when doing hm:t joins. fixes #1322

  • Loading branch information...
1 parent 579d044 commit 179a8a46f91f71c2b0a7d306abbfc4259b61e717 @tenderlove tenderlove committed May 26, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 activerecord/lib/active_record/associations/through_association_scope.rb
@@ -37,7 +37,9 @@ def construct_quoted_owner_attributes(reflection)
elsif reflection.macro == :belongs_to
{ reflection.klass.primary_key => @owner.class.quote_value(@owner[reflection.primary_key_name]) }
else
- { reflection.primary_key_name => @owner[reflection.active_record_primary_key] }
+ column = @owner.class.columns_hash[reflection.active_record_primary_key]
+
+ { reflection.primary_key_name => @owner.class.quote_value(@owner[reflection.active_record_primary_key], column) }
end
end

0 comments on commit 179a8a4

Please sign in to comment.