ruby on rails - i18n for select boxes -



ruby on rails - i18n for select boxes -

i have model named role. , using helper below in form. there way alter value of name attribute language?

<%= f.collection_select :role_id, role.all, :id, name, {} -%>

locales/de.yml

de: role: admin: "something" editor: "something something"

in model:

class role < activerecord::base def translated_name i18n.t(name, :scope => 'role') end end

in view:

<%= f.collection_select :role_id, role.all, :id, :translated_name -%>

ruby-on-rails internationalization rails-i18n

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -