In edit.html.erb I tried
<%= @routine.check_box :archive %>, which caused: ActionView::Template::Error (undefined method 'check_box' for #<Routine:0x007f836fe69de0>):
I then tried in edit:
<%= simple_form_for(@routine) do |f| %>
<%= f.check_box :archive %>
<% end %>
That removed the error, but when I clicked on the checkbox it wouldn't update to true.
schema
t.boolean "archive", default: false
routines_controller
def edit
end
def update
respond_modal_with @routine, location: root_path
end
def routine_params
params.require(:routine).permit(
:archive,)
end
Aucun commentaire:
Enregistrer un commentaire