Form causing error => "Only post requests are allowed"?

Why does the form give the error “Only post requests are allowed.”
when submitted to my action? I know the form is supposed to be a post.
the rake routes looks ok. some reason there is a “_method”=>“put” in
the reques parameters, would this cause it? how do i change the form
code to prevent this?



“address”=>{“address”=>“123 some street, boston, ma”}}

rake routes

{:controller=>“addresses”, :action=>“verify_edit”}


<% form_for([@club, @address], :url =>
verify_edit_club_address_path(@club, @address)) do |f| -%>

<%= f.text_area :address %>

<%= f.submit "Save" %>

<% end -%>

html of generated form

123 some street, boston, ma

<% form_for([@club, @address], :url =>
verify_edit_club_address_path(@club, @address)) do |f| -%>

This way, Rails should be able to find out the right method by itself.
It depends on the state of @address.
If it’s generated with
@address =
and not saved, it’ll generate a put, otherwise if it’s based on an
record in the db, (eg Address.find(…)) it’ll be a post

But you can change the form method easy enough if necessary:

<% form_for([@club, @address], :url =>
verify_edit_club_address_path(@club, @address), :method => :post) do |
f| -%>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs