# Two redirect\_to from one action

**URL:** <https://www.ruby-forum.com/t/two-redirect-to-from-one-action/91136>\
**Category:** Rails\
**Created:** [April 5, 2007, 12:24am UTC](https://www.ruby-forum.com/t/two-redirect-to-from-one-action/91136 "2007-04-05T00:24:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [April 5, 2007, 12:24am UTC](https://www.ruby-forum.com/t/two-redirect-to-from-one-action/91136/1 "2007-04-05T00:24:20Z")

</div>

I have a ‘login’ action that I would like to simultaneously move to the  
next page and to open a separate popup window for a time clock function.

I can easily create a popup window from a clickable link but  
essentially, what I want it to do is…

redirect\_to(:controller =\> “main\_tabnav” )  
and  
render( :controller =\> ‘in\_outs’, :action =\> ‘edit\_io’,  
:template =\> ‘in\_outs/edit\_io’, :id =\> session[:user\_id],  
:popup =\> [‘new\_window’, ‘height=324,width=680’])

though the last part doesn’t work because there is some setup in in\_outs  
controller that I would like to also execute so I would actually want it  
to run ‘edit\_io’ method of InOutsController but it’s obvious that I will  
never be able to execute both ‘redirect\_to’ statements within one  
method.

Any suggestions?

–  
Craig W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [April 5, 2007, 12:41am UTC](https://www.ruby-forum.com/t/two-redirect-to-from-one-action/91136/2 "2007-04-05T00:41:21Z")

</div>

> :popup =\> [‘new\_window’, ‘height=324,width=680’])
> 
> though the last part doesn’t work because there is some setup in in\_outs  
> controller that I would like to also execute so I would actually want it  
> to run ‘edit\_io’ method of InOutsController but it’s obvious that I will  
> never be able to execute both ‘redirect\_to’ statements within one  
> method.
> 
> Any suggestions?

Send back a page of javascript that opens the new window (which kicks  
off  
your edit\_io request) as well as replaces the current window with your  
‘next page’.

-philip

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [April 5, 2007, 1:57am UTC](https://www.ruby-forum.com/t/two-redirect-to-from-one-action/91136/3 "2007-04-05T01:57:27Z")

</div>

On Wed, 2007-04-04 at 15:52 -0700, Philip H. wrote:

> > :popup =\> [‘new\_window’, ‘height=324,width=680’])  
> > your edit\_io request) as well as replaces the current window with your  
> > ‘next page’.

* * *

OK - makes sense…any pointers off the top of your head for javascripts  
to do this - I see all sorts of little issues of having to pass  
variables for the ‘session[:user\_id’] variable for my edit\_io method and  
I am fairly certain that this is suggestion infers a non-rails solution.

–  
Craig W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
