Rails 4 not changing post method to patch

前端 未结 4 918
萌比男神i
萌比男神i 2021-01-14 08:34

I am trying to submit a form, but if I just put form_for @classroom I get a \"No route matches [POST]\" error.

Now with the code posted below, I get th

4条回答
  •  猫巷女王i
    2021-01-14 09:24

    To add a bit of specificity, to Tashow's answer above (which set me on the right track), I had some hidden fields that look'd like this, in a nested form.:

    <%= hidden_field_tag("Classroom[classroom_teachers_attributes][]", nil) %>
    <%= hidden_field_tag("Classroom[classroom_teachers_attributes][]", '') %>
    

    Once I got rid of these, everything began working properly again. (There still remained similar-looking tags generated by fields_for, etc.)

提交回复
热议问题