diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-07-02 11:22:18 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-07-02 11:22:18 -0700 |
commit | ede2f0c71214fa9564df3cbb1f3e60796f1b39bd (patch) | |
tree | 1daa605ad7598cd961aa95c269eaef185b8de7bf /activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb | |
parent | 9cdf8912374bffa8e9b1797237582876a4e8ec4e (diff) | |
parent | 39ee74c4058d67dfabaf62b41994eee1a79c1bf2 (diff) | |
download | rails-ede2f0c71214fa9564df3cbb1f3e60796f1b39bd.tar.gz rails-ede2f0c71214fa9564df3cbb1f3e60796f1b39bd.tar.bz2 rails-ede2f0c71214fa9564df3cbb1f3e60796f1b39bd.zip |
Merge pull request #11253 from neerajdotname/removed-insert-sql
Removed support for deprecated `insert_sql` in associations.
Diffstat (limited to 'activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb index bb3e3db379..fc0d6f7598 100644 --- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb @@ -18,16 +18,12 @@ module ActiveRecord end end - if options[:insert_sql] - owner.connection.insert(interpolate(options[:insert_sql], record)) - else - stmt = join_table.compile_insert( - join_table[reflection.foreign_key] => owner.id, - join_table[reflection.association_foreign_key] => record.id - ) + stmt = join_table.compile_insert( + join_table[reflection.foreign_key] => owner.id, + join_table[reflection.association_foreign_key] => record.id + ) - owner.class.connection.insert stmt - end + owner.class.connection.insert stmt record end |