This project is archived and is in readonly mode.
Routing error for restful resource under namespace
-
Andrew White
It's because the form_for tag is setting the HTTP method to PUT since it thinks it's editing the notebook model instance. Add :html => { :method => :post } to the form_for tag and it works.
-
Alex Le
Andrew, thanks a bunch. I have updated my code and your suggestion worked for me. I saw the PUT in the sever log but it didn't ring a bell for me, since the "rake routes" shows that the path is POST so I did not pay too much attention to the generated form code.
I still think this is a bug, because member methods should be regular POST's, not PUT's. At least this was the way Rails 2.x would work (please correct me if I'm wrong)
-
Andrew White
Alex, the form_for code doesn't look at routes when building the form tag - it justs sees an existing record and assumes that you're editing the object which is obviously a HTTP PUT with RESTful routes. You could argue that your toggle method should be a PUT since it's a specific case of editing a record.
This is exactly the same as in 2.x.
-
Rohit Arondekar
Alex, has Andrew cleared your issue? Can I close this ticket?
-
DHH
- State changed from new to invalid
-
Alex Le
Thanks for clearing up the confusion. Please go ahead and close the issue.