Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在做类似于这个例子的事情,在 RailsCast 中显示
它工作正常,但我希望以表格形式翻译这些角色。我可以在哪里设置这个?我的意思是那些不是真正的属性,只是定义数组的元素
编辑config/locales/en.yml或任何你想要的语言。
config/locales/en.yml
en: roles: admin: 'Super Admin' moderator: 'Editor' author: 'Owner'
然后以您的形式:
<%= check_box_tag "user[roles][]", t("roles.#{role}"), @user.roles.include?(role) %>