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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
73c04e9ef9ca435c5b19a2e765ae6d20?d=identicon&s=25 Max Williams (max-williams)
on 2008-10-10 11: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 }
  end

And it shows up in rake routes as

update_bundle_admin_resource PUT
/admin/resources/:id/update_bundle
{: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) %>"
method="post">
<input type="hidden" name="_method" value="put" />

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

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

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
73c04e9ef9ca435c5b19a2e765ae6d20?d=identicon&s=25 Max Williams (max-williams)
on 2008-10-10 11: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.