diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-03-02 07:40:11 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-03-02 07:41:12 -0800 |
commit | 10058ea2805e2347fe070b937c62c878269d1b1d (patch) | |
tree | 40b7b6f027210f0592abea8cdf416a9c3deb7a34 /activerecord | |
parent | 230393a5bdf10089006b7666fa15cb4543a46486 (diff) | |
download | rails-10058ea2805e2347fe070b937c62c878269d1b1d.tar.gz rails-10058ea2805e2347fe070b937c62c878269d1b1d.tar.bz2 rails-10058ea2805e2347fe070b937c62c878269d1b1d.zip |
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
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/transactions.rb | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index b620233c3a..91ea81f2d2 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -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 |