# Automating workflow

**URL:** <https://www.ruby-forum.com/t/automating-workflow/128300>\
**Category:** Rails\
**Created:** [February 6, 2008, 3:43pm UTC](https://www.ruby-forum.com/t/automating-workflow/128300 "2008-02-06T15:43:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![donv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@donv](https://www.ruby-forum.com/u/donv)\
**Post date:** [February 6, 2008, 3:43pm UTC](https://www.ruby-forum.com/t/automating-workflow/128300/1 "2008-02-06T15:43:10Z")

</div>

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 K.  
Datek Wireless AS

> **[Datek | Nordens ledende leverandør av IoT-løsninger](https://www.datek.no/)**
>
> Over 20 års erfaring innen teknologi og en solid aktør innen lysstyring, smarthus, smart infrastruktur, flåtestyring og konsulenttjenester. Kontakt oss.

Norway

---

<div class="post-metadata">

**Author:** ![donv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@donv](https://www.ruby-forum.com/u/donv)\
**Post date:** [February 6, 2008, 5:08pm UTC](https://www.ruby-forum.com/t/automating-workflow/128300/2 "2008-02-06T17:08:25Z")

</div>

On 06 Feb 2008, at 12:17, Uwe K. wrote:

> 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

---

<div class="post-metadata">

**Author:** ![donv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@donv](https://www.ruby-forum.com/u/donv)\
**Post date:** [February 7, 2008, 8:28pm UTC](https://www.ruby-forum.com/t/automating-workflow/128300/3 "2008-02-07T20:28:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![donv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@donv](https://www.ruby-forum.com/u/donv)\
**Post date:** [February 8, 2008, 10:49am UTC](https://www.ruby-forum.com/t/automating-workflow/128300/4 "2008-02-08T10:49:23Z")

</div>

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

```

 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
