diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-04-12 22:11:38 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-12 22:11:38 +0900 |
commit | ef0c5fe0d98ad1b1b27fe3d6d19ae62aed3e8aa1 (patch) | |
tree | caa318332ff73980197425312d88a380000ce01e /activerecord/lib | |
parent | 186566c58a559452883ae9f7a2d837ebf40be1f4 (diff) | |
parent | bcb0fb792735e1be08ccffb153654cfc886e5ff4 (diff) | |
download | rails-ef0c5fe0d98ad1b1b27fe3d6d19ae62aed3e8aa1.tar.gz rails-ef0c5fe0d98ad1b1b27fe3d6d19ae62aed3e8aa1.tar.bz2 rails-ef0c5fe0d98ad1b1b27fe3d6d19ae62aed3e8aa1.zip |
Merge pull request #35918 from kamipo/lazy_sync_with_transaction_state_on_destroy
Lazy sync with transaction state on destroy
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/core.rb | 3 | ||||
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 1 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index eb4b48bc37..6fed3e5c19 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -466,6 +466,7 @@ module ActiveRecord # Returns +true+ if the attributes hash has been frozen. def frozen? + sync_with_transaction_state @attributes.frozen? end @@ -583,7 +584,7 @@ module ActiveRecord end def thaw - if frozen? + if @attributes.frozen? @attributes = @attributes.dup end end diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index e05490753f..bc6d04b7bb 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -530,7 +530,6 @@ module ActiveRecord def destroy _raise_readonly_record_error if readonly? destroy_associations - self.class.connection.add_transaction_record(self) @_trigger_destroy_callback = if persisted? destroy_row > 0 else |