mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Removed support for deprecated insert_sql
in associations.
This commit is contained in:
parent
9cdf891237
commit
39ee74c405
3 changed files with 10 additions and 10 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
* Removed support for deprecated `insert_sql` in associations.
|
||||||
|
|
||||||
|
*Neeraj Singh*
|
||||||
|
|
||||||
* Removed support for deprecated `finder_sql` in associations.
|
* Removed support for deprecated `finder_sql` in associations.
|
||||||
|
|
||||||
*Neeraj Singh*
|
*Neeraj Singh*
|
||||||
|
|
|
@ -5,7 +5,7 @@ module ActiveRecord::Associations::Builder
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid_options
|
def valid_options
|
||||||
super + [:join_table, :association_foreign_key, :delete_sql, :insert_sql]
|
super + [:join_table, :association_foreign_key, :delete_sql]
|
||||||
end
|
end
|
||||||
|
|
||||||
def build
|
def build
|
||||||
|
|
|
@ -18,16 +18,12 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if options[:insert_sql]
|
stmt = join_table.compile_insert(
|
||||||
owner.connection.insert(interpolate(options[:insert_sql], record))
|
join_table[reflection.foreign_key] => owner.id,
|
||||||
else
|
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
|
owner.class.connection.insert stmt
|
||||||
end
|
|
||||||
|
|
||||||
record
|
record
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue