diff options
Diffstat (limited to 'activerecord/lib/active_record/transactions.rb')
-rw-r--r-- | activerecord/lib/active_record/transactions.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index 9f52734e00..49a8206c84 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -432,9 +432,8 @@ module ActiveRecord end @mutations_from_database = nil @mutations_before_last_save = nil - pk = self.class.primary_key - if pk && @attributes.fetch_value(pk) != restore_state[:id] - @attributes.write_from_user(pk, restore_state[:id]) + if @attributes.fetch_value(@primary_key) != restore_state[:id] + @attributes.write_from_user(@primary_key, restore_state[:id]) end freeze if restore_state[:frozen?] end |