Forum: Ruby on Rails Beware of HashWithIndifferentAccess#symbolize_keys!

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cbff7ea94c9b2c4d5f7cfefd25be9ae2?d=identicon&s=25 Just Someone (Guest)
on 2006-05-14 02:08
(Received via mailing list)
Hi,

I just posted a patch tot he rails trac for a bug we found where
running symbolize_keys! on a HashWithIndifferentAccess will delete all
items from the hash. Please make sure you either never call
symbolize_keys! (or to_options! which just alias it) on a
HashWithIndifferentAccess, or apply the path attached from the ticket
at: http://dev.rubyonrails.org/ticket/5076

I also posted a much longer explanation in my blog at:
http://devblog.famundo.com/articles/2006/05/13/bew...

Please note that symbolize_keys (without the ! at the end) works as
designed.

Bye,

Guy.
This topic is locked and can not be replied to.