Ruby on Rails Friday, November 10, 2017

Looks like this was a bug and is fixed: https://github.com/rails/rails/commit/8de7df5b22e853f028e5a71b26d45a0ce7a2c0f4#diff-da764be48e98c7b140730924b50595b0

On Friday, 10 November 2017 10:26:31 UTC, Kris wrote:
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/39dd4c57-37af-4cbd-afcb-ab3dac962b14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment