1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

remove useless instance variable

depth is always 0, so the index will always be false.  No reason to
create the instance variable if it isn't used
This commit is contained in:
Aaron Patterson 2015-03-02 07:40:11 -08:00
parent 230393a5bd
commit 10058ea280

View file

@ -469,18 +469,13 @@ module ActiveRecord
# method recursively goes through the parent of the TransactionState and
# checks if the ActiveRecord object reflects the state of the object.
def sync_with_transaction_state
update_attributes_from_transaction_state(@transaction_state, 0)
update_attributes_from_transaction_state(@transaction_state)
end
def update_attributes_from_transaction_state(transaction_state, depth)
@reflects_state = [false] if depth == 0
def update_attributes_from_transaction_state(transaction_state)
if transaction_state && transaction_state.finalized? && !has_transactional_callbacks?
unless @reflects_state[depth]
restore_transaction_record_state if transaction_state.rolledback?
clear_transaction_record_state
@reflects_state[depth] = true
end
restore_transaction_record_state if transaction_state.rolledback?
clear_transaction_record_state
end
end
end