diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-08-18 15:17:07 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-18 15:17:07 +0900 |
commit | 18abe37aa8bbc5012124f90aaf93336a57b52642 (patch) | |
tree | 1abdce6b20edeb93328863ff449b107a3cd430c4 /activerecord/lib | |
parent | 7612675fb76e1dcfc1c37fe08f951d476cae6d27 (diff) | |
download | rails-18abe37aa8bbc5012124f90aaf93336a57b52642.tar.gz rails-18abe37aa8bbc5012124f90aaf93336a57b52642.tar.bz2 rails-18abe37aa8bbc5012124f90aaf93336a57b52642.zip |
Restore the ability that SQL with binds for `insert`, `update`, and `delete` (#29944)
Since 213796f, it was lost the ability that SQL with binds for `insert`,
`update`, and `delete` (like `select_all`). This restores the ability
because `insert`, `update`, and `delete` are public API, so it should
not be removed without deprecation.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index ea08319c05..4078345abf 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -144,22 +144,22 @@ module ActiveRecord # # If the next id was calculated in advance (as in Oracle), it should be # passed in as +id_value+. - def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil) - sql, binds = to_sql_and_binds(arel) + def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = []) + sql, binds = to_sql_and_binds(arel, binds) value = exec_insert(sql, name, binds, pk, sequence_name) id_value || last_inserted_id(value) end alias create insert # Executes the update statement and returns the number of rows affected. - def update(arel, name = nil) - sql, binds = to_sql_and_binds(arel) + def update(arel, name = nil, binds = []) + sql, binds = to_sql_and_binds(arel, binds) exec_update(sql, name, binds) end # Executes the delete statement and returns the number of rows affected. - def delete(arel, name = nil) - sql, binds = to_sql_and_binds(arel) + def delete(arel, name = nil, binds = []) + sql, binds = to_sql_and_binds(arel, binds) exec_delete(sql, name, binds) end |