diff options
author | Joe Rafaniello <jrafanie@redhat.com> | 2016-02-25 09:52:36 -0500 |
---|---|---|
committer | Joe Rafaniello <jrafanie@redhat.com> | 2016-02-25 10:13:12 -0500 |
commit | 0379da6abced76835368e7db5fe853571b055391 (patch) | |
tree | e0b055e320e2d10157265542235480871e7edc61 /actionview | |
parent | 2fda4e0874a97a76107ab9e88305169f2c625933 (diff) | |
download | rails-0379da6abced76835368e7db5fe853571b055391.tar.gz rails-0379da6abced76835368e7db5fe853571b055391.tar.bz2 rails-0379da6abced76835368e7db5fe853571b055391.zip |
Fix uniqueness validation with an after_create hook.
record.id_was is nil in after_create/after_save, so we should use
id in these cases.
While this logic feels incomplete, the existing update_record uses the same
logic:
https://github.com/rails/rails/blob/2fda4e0874a97a76107ab9e88305169f2c625933/activerecord/lib/active_record/relation.rb#L83
This logic was originally added for a similar problem:
updates not working with after_create hook.
See: 482f8c15b1d699c95bfbc3d836f674a09c0d9031
Followup to #23581
Fixes #23844
Diffstat (limited to 'actionview')
0 files changed, 0 insertions, 0 deletions