For each box a User checks off, how can we add +1 to t.integer :missed
?
Currently,
The index shows <%= habit.missed %>
.
The form <%= f.check_box :missed %>
. Should I use f.collection_check_boxes
instead?
The model
scope :missed, -> { where(missed: 1) }
scope :nonmissed, -> { where(missed: 0) }
I couldn't get it to work with scope.
Right now even if a User clicks on the :missed
checkbox the integer still shows up as 0 in the index (this is because the checkmark isn't saving upon submitting).
How can we make this work with 15 checkboxes in the _form?
Thank you in advance =]
Aucun commentaire:
Enregistrer un commentaire