aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/citext_test.rb
diff options
context:
space:
mode:
authorEugene Kenny <elkenny@gmail.com>2017-03-13 02:01:18 +0000
committerEugene Kenny <elkenny@gmail.com>2017-07-09 01:26:20 +0100
commitb19c4eff47d912ee3a038a6e0653eea7df5b67b8 (patch)
tree7412e9d3c3e019d6f6e93ff1e328836412ecca65 /activerecord/test/cases/adapters/postgresql/citext_test.rb
parent72e1c4229ab0af6a76c1635adff76fc02fa7fe71 (diff)
downloadrails-b19c4eff47d912ee3a038a6e0653eea7df5b67b8.tar.gz
rails-b19c4eff47d912ee3a038a6e0653eea7df5b67b8.tar.bz2
rails-b19c4eff47d912ee3a038a6e0653eea7df5b67b8.zip
Sync transaction state when accessing primary key
If a record is modified inside a transaction, it must check the outcome of that transaction before accessing any state which would no longer be valid if it was rolled back. For example, consider a new record that was saved inside a transaction which was later rolled back: it should be restored to its previous state so that saving it again inserts a new row into the database instead of trying to update a row that no longer exists. The `id` and `id=` methods defined on the PrimaryKey module implement this correctly, but when a model uses a custom primary key, the reader and writer methods for that attribute must check the transaction state too. The `read_attribute` and `write_attribute` methods also need to check the transaction state when accessing the primary key.
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql/citext_test.rb')
0 files changed, 0 insertions, 0 deletions