key = 'foo' key.frozen? # => false TextFieldDefinition.create(key: key) key.frozen? # => true (not expected)
I created a minimal example to demonstrate the bug this but it does not reproduce it.
It appears that in my production code
ActiveModel::Type::ImmutableString#cast_type, which freezes the value, is called, but isn’t in my attempt at a reproduction of the bug.
I’m assuming Rails shouldn’t modify input’s in any way and should
#dup them first.