Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use keyword args on committed! and rolledback! #18425

Merged
merged 1 commit into from
Jan 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ def rollback
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

Expand All @@ -88,7 +88,7 @@ def commit_records
end
ensure
ite.each do |i|
i.committed!(false)
i.committed!(should_run_callbacks: false)
end
end

Expand Down
4 changes: 2 additions & 2 deletions activerecord/lib/active_record/transactions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,15 +300,15 @@ def rollback_active_record_state!
#
# 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
end

# 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)
Expand Down