Ruby on Rails latest stable (v5.2.3) - 2 notes - Class: HashWithIndifferentAccess

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.

These similar methods exist in v5.2.3:

symbolize_keys!() public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Show source
Register or log in to add new notes.
June 29, 2008
6 thanks

Turns hash keys into symbols

This method is part of ActiveSupport, which is a collection of classes and standard library extensions that are useful for Rails.

symbolize_keys! returns a new hash with all keys converted to symbols.

This can be helpful when you have a non-ActiveRecord model and you want your initialize method to take a hash of parameters. If you symbolize the hash, you can extract your parameters regardless of whether initialize received a hash of strings or hash of symbols.

October 30, 2008
2 thanks

Does very litle

This method simply returns the hash itself since HashWithIndifferentAccess by definition support symbolized key access. For a (regular rails) Hash there is ActiveSupport::CoreExtensions::Hash::Keys#symbolize_keys! that “Destructively convert all keys to symbols”.