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 -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -