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 the wrong url in the form. If I change the url manually in the browser it goes through, and I guess I could do that via javascript, but... why... is... this... happening..?
Until yesterday everything was working fine. I even tried rolling back to the things I changed but I can't seem to track what is going wrong.
routes.rb
patch 'classrooms/:id/update' => "classrooms#update", as: :update_classroom
resources :classrooms, except: :update
form from rails end
<%= form_for(update_classroom_path(@classroom), method: "patch") do |class_f| %>
form in browser
<form action="/classrooms/23/edit" accept-charset="UTF-8" method="post">
<input name="utf8" type="hidden" value="✓">
<input type="hidden" name="_method" value="patch">
<input type="hidden" name="authenticity_token" value="******">
rake routes
absences POST /absences(.:format) absences#create
POST /classrooms/:id/getAbsences(.:format) classrooms#getAbsences
update_classroom PATCH /classrooms/:id/update(.:format) classrooms#update
classrooms GET /classrooms(.:format) classrooms#index
POST /classrooms(.:format) classrooms#create
new_classroom GET /classrooms/new(.:format) classrooms#new
edit_classroom GET /classrooms/:id/edit(.:format) classrooms#edit
classroom GET /classrooms/:id(.:format) classrooms#show
DELETE /classrooms/:id(.:format) classrooms#destroy
root GET / pages#start