Skip to content

Commit

Permalink
Remove unnecessary scoping for creating hm:t join record
Browse files Browse the repository at this point in the history
  • Loading branch information
lifo committed Aug 10, 2009
1 parent 50b8398 commit ad28e00
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -65,9 +65,10 @@ def insert_record(record, force = true, validate = true)
return false unless record.save(validate)
end
end
through_reflection = @reflection.through_reflection
klass = through_reflection.klass
@owner.send(@reflection.through_reflection.name).proxy_target << klass.send(:with_scope, :create => construct_join_attributes(record)) { through_reflection.create_association! }

through_association = @owner.send(@reflection.through_reflection.name)
through_record = through_association.create!(construct_join_attributes(record))
through_association.proxy_target << through_record
end

# TODO - add dependent option support
Expand Down

0 comments on commit ad28e00

Please sign in to comment.