Skip to content
New issue

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

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

Already on GitHub? Sign in 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

ashish91
Copy link

@ashish91 ashish91 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}

@ashish91 ashish91 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
@ashish91 ashish91 deleted the translation_symbolization_rails branch February 9, 2018 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants