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

i18n array with int keys #27

Closed
webchi opened this issue Jun 12, 2016 · 1 comment
Closed

i18n array with int keys #27

webchi opened this issue Jun 12, 2016 · 1 comment

Comments

@webchi
Copy link

webchi commented Jun 12, 2016

For sorting action need [["planed", 0], ["done", 1], ["loaded", 2]] with translated key.
But Model.statuses_i18n returns array with value = translated(key) and there is no integer keys to find something in database.
Maybe it's not so hard to make enums translated with integer keys?

@zmbacker
Copy link
Owner

zmbacker commented Nov 3, 2016

I think you need the method Model.statuses which returns a Hash value: {"planed"=> 0, "done"=> 1, "loaded"=> 2}. Model.statuses["planed"] can get the integer value you needed.

@zmbacker zmbacker closed this as completed Nov 3, 2016
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

No branches or pull requests

2 participants