Forum: Ruby on Rails Form works with POST but not PUT

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Max W. (Guest)
on 2008-10-10 13:31
I have a form that's stopped working.  It calls a PUT action - the route
is defined thus (other routes omitted for clarity):

  map.namespace :admin do |admin|
    admin.resources :resources, :member => { :update_bundle => :put }

And it shows up in rake routes as

update_bundle_admin_resource PUT
{:action=>"update_bundle", :controller=>"admin/resources"}

So far so good.  The problem seems to be with my form - i can't get it
to make a put request.  Initially it was like this:

<form action="<%= update_bundle_admin_resource_path(@resource) %>"
<input type="hidden" name="_method" value="put" />

Looking in my logs, it's generating this request:

Processing ResourcesController#4557 (for at 2008-10-10
10:22:44) [GET]
  Parameters: {"action"=>"4557", "id"=>"update_bundle",

I tried changing it to a form_tag (which should just generate the same
html as i already have):

<% form_tag update_bundle_admin_resource_path(@resource), :method =>
:put do -%>

But i get the same result.  Can anyone see if i'm doing something wrong?

Like i said, this used to work fine, but we just did a big
branch-swapping deploy and maybe something somewhere is screwing it up.
I have no idea what though.

thanks, max
Max W. (Guest)
on 2008-10-10 13:33
Oh, and i forgot to mention - if i change it to use POST instead of PUT
then everything works fine.  But i'd rather find out why it's breaking.
This topic is locked and can not be replied to.