What would be the way to go on having a locale selection drop down in a form?
I have a User model with a column "lng" where I store the "en","fr", etc i18n locale strings.
My goal is to have a drop down with all the languages listed " English ", " French " and on form update it stores the correct "en", "fr" value in the user table.
What would be a way to go on this?
You can simply use the select tag http://guides.rubyonrails.org/form_helpers.html#the-select-and-option-tags:
I also suggest to move the array somewhere to the constant. For example, in its own method of model User. For example:
edited
In simple form you can use rails form helpers like this https://github.com/plataformatec/simple_form#wrapping-rails-form-helpers:
Or you can use
collection
option https://github.com/plataformatec/simple_form#collections: