Skip to content

Write repository_storages without type casting

Jarka Košanová requested to merge rails5-fix-application-setting-spec into master

What does this MR do?

It changes specs to use update_all instead of raw_write_attribute because raw_write_attribute serializes the before_type_cast value in Rails 5.

Are there points in the code the reviewer needs to double check?

raw_write_attribute method will probably be available in Rails 5.2 under another name (https://github.com/rails/rails/commit/dff37ff613d12201c2b770dbc61b125792c7bb6e). As this MR removes its usage anyway we don't have to worry about it, just mentioning it here.

Why was this MR needed?

I am not 100% sure which particular change causes the spec failing for Rails 5 and working for Rails 4 as there are multiple changes between 4.1 and 5.1 in both writing and reading values with/without casting. However this is my guess:

While in Rails 4.2 the serializing is not done during the raw write it is in Rails 5.0. I think it is caused by https://github.com/rails/rails/commit/8e633e505880755e7e366ccec2210bbe2b5436e7 - after that the serialization is done when using raw_write_attribute as part of https://github.com/rails/rails/blob/8e633e505880755e7e366ccec2210bbe2b5436e7/activerecord/lib/active_record/attribute_methods/dirty.rb#L63 .

What are the relevant issue numbers?

Closes #46238 (closed)

Edited by Jarka Košanová

Merge request reports