vendredi 3 juillet 2015

how to save multiple checkboxes in a single column of string datatype? how to write migration for this column in rails4?

i'am having the following code in my view.<%= f.collection_check_boxes :week_1, %w[Sunday Monday Tuesday], :to_s, :to_s,:selected => @shift.week_1 %> and in migration t.string :week_1 , array: true when i save this form (in new action) the selected Check box data is saving to the db. but in edit action the check boxes are not getting selected to the database values? iam using form for helper.




Aucun commentaire:

Enregistrer un commentaire