This project is archived and is in readonly mode.
form_for targeting wrong url
Reported by Raf | January 31st, 2010 @ 09:07 AM
I SOLVED THIS PROBLEM WITH :URL => RESOURCE_PATH(@RESOURCE), BUT I DON'T KNOW HOW TO CLOSE THE TICKET. PLEASE CLOSE THIS, IF YOU COME ACROSS IT.
Wondering if anyone can help, or is having the same problem. I have a form_for helper nested inside an index view, because index viewers need to be able to update a parameter without going to a separate page (like the edit route). But this form is sending a put request to the non-specific route (/resources) instead of the specific route indicated in the generated html (/resources/:id). Put requests should be directed to the specific route to call the update action, so I'm getting an error and the database does not update.
(controller is default scaffolded version)
(index.html.erb)
<td><% form_for :resource do |f|%>
<%= f.text_field :parameter %>
<%= f.submit 'Update' %>
<% end %></td>
(routes.rb) map.resources :resources
(generated html)
(development log) Processing ApplicationController#index (for
127.0.0.1 at 2010-01-31 03:33:08) [PUT] ActionController::MethodNotAllowed (Only get and post requests are allowed.) |
Comments and changes to this ticket
-
Raf January 31st, 2010 @ 08:27 PM
- no changes were found...
-
Ryan Bigg June 12th, 2010 @ 03:19 AM
- State changed from new to invalid
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>