Saving and reproducing a POST request

Hi

I have an action which saves the originating resource from which it
was called, and returns to it later. This is done by setting:

session[:return_to] = request.referer

redirect_to(session[:return_to])

Which works great for GET resources. The problem is that POST
variables aren’t kept in request.referer, so this method fails when
the originating resource is a a POST.

What’s a good way do the above for POST resources?

Le mercredi 28 juin 2006 10:11, Alder G. a écrit :

Hi

Hello

What’s a good way do the above for POST resources?

You can maybe use redirect_to(:back)

On 6/28/06, Nicolas C. [email protected] wrote:

redirect_to(session[:return_to])

Which works great for GET resources. The problem is that POST
variables aren’t kept in request.referer, so this method fails when
the originating resource is a a POST.

What’s a good way do the above for POST resources?

You can maybe use redirect_to(:back)

No, since redirect_to(:back) is merely short-hand for
redirect_to(request.env[“HTTP_REFERER”]). So it will recreate only GET
requests, not POST as I need.

Frankly, I’m somewhat surprised there’s no reasonable way to do it in
Rails. It’s a pretty common pattern.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs