Ruby on Rails Friday, November 10, 2017

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.

Any ideas?

I'm assuming Rails shouldn't modify input's in any way and should `#dup` them first.

Many thanks.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/84774599-ef39-4080-8861-7571f791591a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment