我有以下haml代码
%nav.breadcrumbs
%h2 Breadcrumbs
%ol
%li
%a{href: data_sources_path} #{t('Defaults.Home')}
%li
%a
%li
%em #{t('Registrations.new.AccessRequest')}
%br
%h3#content-header1.content-header #{t('Registrations.new.Header')}
%section.form
%form.standard{action: registrations_path, method: 'post'}
%fieldset{"aria-labelledby" => "content-header"}
%input{type: 'hidden', name: 'authenticity_token', value: form_authenticity_token.to_s}
%legend
%ul
%li
%label
#{t('Registrations.new.CheckBoxHeader')}
%abbr.required{title: "Required"} *
- Role::ROLES.each do |role|
%input#roles{name: "access", type: "checkbox",value:"#{role}"}/
%label{for: "roles"} #{role}
%fieldset.input-actions
%legend Actions
%input.primary-action{name: "invoke", type: "submit", value: t('Buttons.Send')}/
%input.cancel{name: "invoke", type: "submit", value: t('Buttons.Cancel')}/
在这里假设我的角色是管理员和可编辑的......我可以成功地将角色显示为复选框,并且 params[:access] 为我提供了我选择的特定角色。假设我选择两个角色 params[:access] 只是返回管理员。我想同时获得这两个角色。任何帮助,将不胜感激。谢谢