我使用simple_form
并有下面的示例代码:轨带回所有复选框,而不是只选一个
<%= f.input :medical_conditions, :label=>false, :collection => medical_conditons, :as => :check_boxes%>
收集持有约100复选框。但是,当用户只选择1或2,一切都还是会被保存到数据库中是这样的:
---
- ""
- ""
- ""
medical_conditions
是我application_helper
def medical_conditons
t = [
"Allergies/Hay Fever",
"Diabetes",
"Heart Surgery"]
return t
end
的medical_conditions
领域一个简单的数组是:string
场。
我需要做什么以便只有选定的值以逗号分隔的方式保存。