Hi all! I have the following case: * A user wants to perform a task that is destructive, so a POST request is issued. * The controller action determines that another task before the first task can be completed, so the original request is stored, and the user is redirected to the seconds task with a redirect_to and a GET request. * The user completes the second task and submits a POST request. * The controller action for the second task completes the second task, detects that the first task is pending and wants to complete the first task. The first request parameters are stored and a redirect_to with these parameters would solve my problem. However a redirect_to results in a GET request, and a POST request is required since it is destructive. Can you suggest a way to solve this? Feel free to redirect me to proper documentation. Uwe Kubosch Datek Wireless AS http://datek.no/ Norway --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 06 Feb 2008, at 12:17, Uwe Kubosch wrote:> * A user wants to perform a task that is destructive, so a POST > request > is issued. > > * The controller action determines that another task before the first > task can be completed, so the original request is stored, and the user > is redirected to the seconds task with a redirect_to and a GET > request. > > * The user completes the second task and submits a POST request. > > * The controller action for the second task completes the second task, > detects that the first task is pending and wants to complete the first > task. > > The first request parameters are stored and a redirect_to with these > parameters would solve my problem. However a redirect_to results in a > GET request, and a POST request is required since it is destructive. > > Can you suggest a way to solve this? Feel free to redirect me to > proper > documentation.I can''t follow your way of thinking, but working in a restful manner should destroy records using the DELETE verb (whether it uses a GET or a POST to emulate that is not your concern anymore). Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Wed, 2008-02-06 at 17:07 +0100, Peter De Berdt wrote:> > I can''t follow your way of thinking, but working in a restful manner > should destroy records using the DELETE verb (whether it uses a GET or > a POST to emulate that is not your concern anymore).By ''destructive'' I mean ''will change the database'', not necessarily delete. Basically, I wish to process the original request, regardless of request method (GET/POST/DELETE/PUT). Uwe --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi all! I now perform the redirect_to for a post request by returning a page containing only a form with the action URL and parameters from the original request: def redirect_to_post(options) url = url_for options render :text => <<EOF, :layout => false <html> <body onload="document.getElementById(''form'').submit()"> <form id="form" action="#{url}" method="POST"> <!-- other params go here as hidden fields --> </form> </body> </html> EOF end Visible effect is a white page before the final result page is displayed. I am a bit uncomfortable by involving the /user/browser in this way, but I am not able to find a better solution. I would rather only process the original request on the server, but I need it to be a POST request. Any suggestions are greatly appreciated. Uwe --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---