【发布时间】:2016-04-28 05:04:42
【问题描述】:
我正在尝试列出具有多项选择的复选框。我在模型中有这个数组。
QOL = ["your health",
"your stress levels",
"how safe you feel",
"your education",
"your home"
]
我正在尝试在我的 simple_form 表单中做类似的事情。
<%= f.input :qolselections, as: :check_boxes, :collection => Goal::QOL %>
如何将选择保存到数据库中并能够将它们作为选定的字符串值检索?
【问题讨论】:
-
您的表单使用什么库,它们看起来像:formtastic 或 simple_form?
-
@Leito 我正在使用 simple_form(我错过了标题中的“m”)
标签: ruby-on-rails ruby-on-rails-4 simple-form