diff options
author | Matthew Draper <matthew@trebex.net> | 2017-08-02 17:21:07 +0930 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-02 17:21:07 +0930 |
commit | ac6cd6800a1eb7dc86ff3897cca7434af636ea48 (patch) | |
tree | 15a2751d59260c785c55e9514ee5bee4a5e92b1d /activerecord/lib/active_record/transactions.rb | |
parent | f9a43f28c087f8ffd35ff7c33a60c938b60f2be2 (diff) | |
parent | b19c4eff47d912ee3a038a6e0653eea7df5b67b8 (diff) | |
download | rails-ac6cd6800a1eb7dc86ff3897cca7434af636ea48.tar.gz rails-ac6cd6800a1eb7dc86ff3897cca7434af636ea48.tar.bz2 rails-ac6cd6800a1eb7dc86ff3897cca7434af636ea48.zip |
Merge pull request #29724 from eugeneius/sync_primary_key
Sync transaction state when accessing primary key
Diffstat (limited to 'activerecord/lib/active_record/transactions.rb')
-rw-r--r-- | activerecord/lib/active_record/transactions.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index 3e8a0789df..f91f0cdf12 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -432,8 +432,8 @@ module ActiveRecord @new_record = restore_state[:new_record] @destroyed = restore_state[:destroyed] pk = self.class.primary_key - if pk && read_attribute(pk) != restore_state[:id] - write_attribute(pk, restore_state[:id]) + if pk && _read_attribute(pk) != restore_state[:id] + _write_attribute(pk, restore_state[:id]) end freeze if restore_state[:frozen?] end |