Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Through-association owner's primary key wasn't quoted. Generates inva…

…lid SQL (id = ) if the record wasn't saved yet (i.e. the primary key's value is nil).
  • Loading branch information...
commit 152c41d524b58951b5b30ca03d1ba8034dd646a9 1 parent d756525
@sirlantis sirlantis authored
2  activerecord/lib/active_record/associations/through_association_scope.rb
@@ -30,7 +30,7 @@ def construct_conditions
# Associate attributes pointing to owner, quoted.
def construct_quoted_owner_attributes(reflection)
if as = reflection.options[:as]
- { "#{as}_id" => @owner[reflection.active_record_primary_key],
+ { "#{as}_id" => @owner.class.quote_value(@owner[reflection.active_record_primary_key]),
"#{as}_type" => reflection.klass.quote_value(,
reflection.klass.columns_hash["#{as}_type"]) }
Please sign in to comment.
Something went wrong with that request. Please try again.