Skip to content

Commit

Permalink
Through-association owner's primary key wasn't quoted. Generates inva…
Browse files Browse the repository at this point in the history
…lid SQL (id = ) if the record wasn't saved yet (i.e. the primary key's value is nil).
  • Loading branch information
NDMarcel committed May 27, 2011
1 parent d756525 commit 152c41d
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -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(
@owner.class.base_class.name.to_s,
reflection.klass.columns_hash["#{as}_type"]) }
Expand Down

0 comments on commit 152c41d

Please sign in to comment.