我已经写了以下内容来接受角色,如何让它接受多个值
= f.simple_fields_for :content_roles do |role|
= role.input :role_id, label: "visible to", as: :select, label: "Role", collection: Role.all, required: true
答案 0 :(得分:2)
只需将multiple: true
添加到您的角色字段。
像这样:
= role.input :role_id, label: "visible to", as: :select, label: "Role", collection: Role.all, required: true, multiple: true
答案 1 :(得分:2)
这是我当前在线项目中的代码。更新缺少的红宝石标签....