I'm trying to pass multiple checkboxes as array to a db table. So i want to add multiple topics to a project.
= form_for @project, url: admin_projects_path, :html => { :multipart => true } do |p|
%p
=p.label :name
=p.text_field :name
%p
= p.label :topic
%p
= p.label "Value1"
= p.check_box(:topic, {:multiple => true}, "value1", nil)
= p.label "Value2"
= p.check_box(:topic, {:multiple => true}, "value2", nil)
= p.label "Value3"
= p.check_box(:topic, {:multiple => true}, "value3", nil)
%p
= p.submit
but here topic returns nil in the projects, even whenever i check multiple checkboxes (i added to the whitelist params in the controller, so that cant be the cause)
What am i doing wrong here?
Aucun commentaire:
Enregistrer un commentaire