Solution to ActionController::MethodNotAllowed (Only get, put, and delete requests are allowed.)
I was having problems with a nested resource….
route.rb
map.resource :accounts do |account|
account.resources :contacts
end
contacts/new.html.erb
<% form_for(@contact) do |f| %>
..
I was getting
ActionController::MethodNotAllowed (Only get, put, and delete requests are allowed.)
fun. I tried a lot of things, I googled it, and didn’t quite find the solution….. After a good 30 minutes, the solution appeared below,
<% form_for(:contact, :url => account_contacts_path(@account) do |f| %>
Good luck!
Thanks! This fixed my problem. I was about to pull my hair out…