Reputation: 16216
Is it possible to redirect from one controller to another using POST request? redirect_to supports only GET. I found something called "post_via_redirect", but it seems that it was deprecated in Rails 3.
Upvotes: 4
Views: 4079
Reputation: 1958
I think you're looking for this question.
The short answer is no, there isn't a way to do this. post_via_redirect
is one of the methods for integration tests, and will not help here.
Upvotes: 3
Reputation: 11
I don't know rails well, but since most of the POST requests are made from user's browser side, as well as the interpretation of the Location header sent by the server, you should look for browser's support for sending back to the server a form that it sent before loading the new page.
The better way I found to pass data from one page/controller to another is to stock the data in the session, and then retrieve it when you need.
If you can't find a rails' internal way to do it, maybe it's a good option.
Upvotes: 1