My issue is shown in 01_bug.rb, the value I pass in gets frozen. It looks like this happens in active_model/type/immutable_string.rb
, #cast_value
.
However as in my attempted reproduce of the bug on a small scale, 02_test.rb, #cast_value
is never called.
UPDATE: I found this has been fixed in master branch of Rails: https://github.com/rails/rails/commit/8de7df5b22e853f028e5a71b26d45a0ce7a2c0f4#diff-da764be48e98c7b140730924b50595b0