I saw an example in the book The Rails 3 Way that says
redirect_to post
Does this have some special meaning because of the post
, or if it is just a poor choice for an example and the post
is just a domain object and it's redirecting to the url for that object.
I would need to see the full example for a complete answer, but my guess is that the author just picked "Post" as the name of one of the models and didn't realize it might cause confusion to the reader with the POST action.
As part of the HTTP Protocol (http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html), you actually can't redirect to a POST action. Or, more explicitly, whatever destination you are calling with a redirect needs to return with the GET method.
Hope that helps!
Look at Rails Routing Guide then it should be clear why that is ok.
Also if you want to see routes for your application run:
cd path/to/your/app
rake routes
This will list routes available in your app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With