1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove unnecessary scoping for creating hm:t join record

This commit is contained in:
Pratik Naik 2009-08-10 21:20:01 +01:00
parent 50b83984f1
commit ad28e0037b

View file

@ -65,9 +65,10 @@ module ActiveRecord
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