Skip to content
This repository
Browse code

Removed support for deprecated `insert_sql` in associations.

  • Loading branch information...
commit 39ee74c4058d67dfabaf62b41994eee1a79c1bf2 1 parent 9cdf891
Neeraj Singh neerajdotname authored
4 activerecord/CHANGELOG.md
Source Rendered
... ... @@ -1,3 +1,7 @@
  1 +* Removed support for deprecated `insert_sql` in associations.
  2 +
  3 + *Neeraj Singh*
  4 +
1 5 * Removed support for deprecated `finder_sql` in associations.
2 6
3 7 *Neeraj Singh*
2  activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb
@@ -5,7 +5,7 @@ def macro
5 5 end
6 6
7 7 def valid_options
8   - super + [:join_table, :association_foreign_key, :delete_sql, :insert_sql]
  8 + super + [:join_table, :association_foreign_key, :delete_sql]
9 9 end
10 10
11 11 def build
14 activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
@@ -18,16 +18,12 @@ def insert_record(record, validate = true, raise = false)
18 18 end
19 19 end
20 20
21   - if options[:insert_sql]
22   - owner.connection.insert(interpolate(options[:insert_sql], record))
23   - else
24   - stmt = join_table.compile_insert(
25   - join_table[reflection.foreign_key] => owner.id,
26   - join_table[reflection.association_foreign_key] => record.id
27   - )
  21 + stmt = join_table.compile_insert(
  22 + join_table[reflection.foreign_key] => owner.id,
  23 + join_table[reflection.association_foreign_key] => record.id
  24 + )
28 25
29   - owner.class.connection.insert stmt
30   - end
  26 + owner.class.connection.insert stmt
31 27
32 28 record
33 29 end

0 comments on commit 39ee74c

Please sign in to comment.
Something went wrong with that request. Please try again.