diff options
author | Eugene Kenny <elkenny@gmail.com> | 2017-06-15 13:00:20 +0100 |
---|---|---|
committer | Eugene Kenny <elkenny@gmail.com> | 2017-06-15 13:00:20 +0100 |
commit | 2e4fe3a4ada95d08a77ff4df5cbf49ada0a10f6d (patch) | |
tree | d86993ee20834723707395795e7b4f8cce1bdb80 /activerecord/test/cases/serialized_attribute_test.rb | |
parent | bbd8084ffe413e1f0848fc09432997011909f232 (diff) | |
download | rails-2e4fe3a4ada95d08a77ff4df5cbf49ada0a10f6d.tar.gz rails-2e4fe3a4ada95d08a77ff4df5cbf49ada0a10f6d.tar.bz2 rails-2e4fe3a4ada95d08a77ff4df5cbf49ada0a10f6d.zip |
Don't map id to primary key in raw_write_attribute
The `raw_write_attribute` method is used to update a record's attributes
to reflect the new state of the database in `update_columns`. The hash
provided to `update_columns` is turned into an UPDATE query directly,
which means passing an `id` key results in an update to the `id` column,
even if the model uses a different attribute as its primary key. When
updating the record, we don't want to apply the `id` column change to
the primary key attribute, since that's not what happened in the query.
Without the code to handle this case, `write_attribute_with_type_cast`
no longer contains any logic shared between `raw_write_attribute` and
`write_attribute`, so we can inline the code into those two methods.
Diffstat (limited to 'activerecord/test/cases/serialized_attribute_test.rb')
0 files changed, 0 insertions, 0 deletions