# Post and redirect from a controller

**URL:** <https://www.ruby-forum.com/t/post-and-redirect-from-a-controller/135155>\
**Category:** Rails\
**Created:** [April 18, 2008, 4:44pm UTC](https://www.ruby-forum.com/t/post-and-redirect-from-a-controller/135155 "2008-04-18T16:44:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/90db22/32.png) [@tomh](https://www.ruby-forum.com/u/tomh)\
**Post date:** [April 18, 2008, 4:44pm UTC](https://www.ruby-forum.com/t/post-and-redirect-from-a-controller/135155/1 "2008-04-18T16:44:12Z")

</div>

Hi,

I am trying to do something similar to a thread,  
[http://groups.google.com/group/rubyonrails-talk/browse\_thread/thread/ad6cfd2d9b5e7e1](http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/ad6cfd2d9b5e7e1)  
but a little different.

Using Paypal (website payments standard), I’m trying to do the  
following in my checkout action:

-transfer session data (the shoppers cart) into the database  
-redirect the user to the paypal site.

My problem is the standard paypal example for this uses a form post:

\<%= hidden\_field\_tag "cmd", "\_cart" %\> .... \<%= submit\_tag "Buy with PayPal", :class =\> "submit" %\> \<% end\_form\_tag %\>

Is there a way I can redirect a user along with a post? (I’ve looked  
at the Net::HTTP stuff, but it appears that just sends the post  
request and doesn’t forward the user with it)

I’m kinda a noob, so is there a better design that I’m missing? Any  
help would be great appreciated.

---

<div class="post-metadata">

**Author:** ![tomh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/90db22/32.png) [@tomh](https://www.ruby-forum.com/u/tomh)\
**Post date:** [November 11, 2009, 11:43am UTC](https://www.ruby-forum.com/t/post-and-redirect-from-a-controller/135155/2 "2009-11-11T11:43:42Z")

</div>

tomh wrote:

> Is there a way I can redirect a user along with a post? (I’ve looked  
> at the Net::HTTP stuff, but it appears that just sends the post  
> request and doesn’t forward the user with it)

Did you get an answer? I wonder the same thing.
