aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-09 18:52:44 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-09 18:52:44 -0200
commit4e48873a929115a1738c699430994fc60d35b68a (patch)
tree9094743acd408deef73f50693f81b914212ae0a8
parentec475547a94315ac207ac4e9bd8f2ac04576230c (diff)
parentc7f56d99e51a62326c3639ca5b95e5416cb1f1d5 (diff)
downloadrails-4e48873a929115a1738c699430994fc60d35b68a.tar.gz
rails-4e48873a929115a1738c699430994fc60d35b68a.tar.bz2
rails-4e48873a929115a1738c699430994fc60d35b68a.zip
Merge pull request #18425 from arthurnn/kargs_transaction
Use keyword args on committed! and rolledback!
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/transaction.rb6
-rw-r--r--activerecord/lib/active_record/transactions.rb4
2 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
index f6ef3b0675..335eb876cf 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb
@@ -69,11 +69,11 @@ module ActiveRecord
def rollback_records
ite = records.uniq
while record = ite.shift
- record.rolledback! full_rollback?
+ record.rolledback!(force_restore_state: full_rollback?)
end
ensure
ite.each do |i|
- i.rolledback!(full_rollback?, false)
+ i.rolledback!(force_restore_state: full_rollback?, should_run_callbacks: false)
end
end
@@ -88,7 +88,7 @@ module ActiveRecord
end
ensure
ite.each do |i|
- i.committed!(false)
+ i.committed!(should_run_callbacks: false)
end
end
diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb
index 9cef50029b..0fd2862b2c 100644
--- a/activerecord/lib/active_record/transactions.rb
+++ b/activerecord/lib/active_record/transactions.rb
@@ -300,7 +300,7 @@ module ActiveRecord
#
# Ensure that it is not called if the object was never persisted (failed create),
# but call it after the commit of a destroyed object.
- def committed!(should_run_callbacks = true) #:nodoc:
+ def committed!(should_run_callbacks: true) #:nodoc:
_run_commit_callbacks if should_run_callbacks && destroyed? || persisted?
ensure
force_clear_transaction_record_state
@@ -308,7 +308,7 @@ module ActiveRecord
# Call the +after_rollback+ callbacks. The +force_restore_state+ argument indicates if the record
# state should be rolled back to the beginning or just to the last savepoint.
- def rolledback!(force_restore_state = false, should_run_callbacks = true) #:nodoc:
+ def rolledback!(force_restore_state: false, should_run_callbacks: true) #:nodoc:
_run_rollback_callbacks if should_run_callbacks
ensure
restore_transaction_record_state(force_restore_state)