Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Convert hashes to hash with indifferent access for rails #644

Closed
wants to merge 1 commit into from
Closed

Convert hashes to hash with indifferent access for rails #644

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Jul 22, 2016

Deals with symbol keys in hash when translating values with I18n (Issue #627). This PR converts the hash to a hash with indifferent access in order to support string or symbol access.

This problem only arises in rails console which converts the hash keys into symbol. Here's an example:

Rails console
2.3.0 :001 > I18n.translate(*["faker.vehicle.manufacture", {:locale=>:en, :raise=>true}]).first
 => {:name=>"MARQUESS ELECTRIC CAR COMPANY", :wmi=>"15E", :wmi_ext=>nil}

IRB console
2.3.0 :003 > I18n.translate(*["faker.vehicle.manufacture", {:locale=>:en, :raise=>true}]).first
 => {"name"=>"MARQUESS ELECTRIC CAR COMPANY", "wmi"=>"15E", "wmi_ext"=>nil}

@ghost ghost mentioned this pull request Jul 22, 2016
stympy added a commit that referenced this pull request Jan 3, 2017
@stympy stympy closed this Jan 3, 2017
@ghost ghost deleted the translation_symbolization_rails branch February 9, 2018 09:33
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant