Automating workflow

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

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

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

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