# Redirect but without change the address

**URL:** <https://www.ruby-forum.com/t/redirect-but-without-change-the-address/130398>\
**Category:** Rails\
**Created:** [February 27, 2008, 11:03pm UTC](https://www.ruby-forum.com/t/redirect-but-without-change-the-address/130398 "2008-02-27T23:03:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![stratboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@stratboy](https://www.ruby-forum.com/u/stratboy)\
**Post date:** [February 27, 2008, 11:03pm UTC](https://www.ruby-forum.com/t/redirect-but-without-change-the-address/130398/1 "2008-02-27T23:03:06Z")

</div>

I want redirect to another controller but without change the address in  
the address bar of browser.

Then is possible to render a page from another controller?  
Thanks

---

<div class="post-metadata">

**Author:** ![stratboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@stratboy](https://www.ruby-forum.com/u/stratboy)\
**Post date:** [February 28, 2008, 12:30am UTC](https://www.ruby-forum.com/t/redirect-but-without-change-the-address/130398/2 "2008-02-28T00:30:44Z")

</div>

Luca R. wrote:

> I want redirect to another controller but without change the address in  
> the address bar of browser.
> 
> Then is possible to render a page from another controller?

If you move the method you wish to call into a controller that  
is a parent of both controllers you can just call that method  
from the requested method. Add a render(:template) call to  
the destination method to ensure that the right view is rendered.

If you don’t need to call the other controller’s action, just  
add the render(:template) call to the requested action when you  
want to “redirect”.

–  
We develop, watch us RoR, in numbers too big to ignore.

---

<div class="post-metadata">

**Author:** ![stratboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@stratboy](https://www.ruby-forum.com/u/stratboy)\
**Post date:** [February 28, 2008, 9:22am UTC](https://www.ruby-forum.com/t/redirect-but-without-change-the-address/130398/3 "2008-02-28T09:22:59Z")

</div>

mmm and how i can to passing an id to template?

ex. i want to render “controller/action/10”

Thanks for the responce

Mark Reginald J. wrote:

> Luca R. wrote:
> 
> > I want redirect to another controller but without change the address in  
> > the address bar of browser.
> > 
> > Then is possible to render a page from another controller?
> 
> If you move the method you wish to call into a controller that  
> is a parent of both controllers you can just call that method  
> from the requested method. Add a render(:template) call to  
> the destination method to ensure that the right view is rendered.
> 
> If you don’t need to call the other controller’s action, just  
> add the render(:template) call to the requested action when you  
> want to “redirect”.
> 
> –  
> We develop, watch us RoR, in numbers too big to ignore.

---

<div class="post-metadata">

**Author:** ![stratboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@stratboy](https://www.ruby-forum.com/u/stratboy)\
**Post date:** [February 28, 2008, 12:07pm UTC](https://www.ruby-forum.com/t/redirect-but-without-change-the-address/130398/4 "2008-02-28T12:07:04Z")

</div>

Must i to use render\_component?

> > –  
> > We develop, watch us RoR, in numbers too big to ignore.

---

<div class="post-metadata">

**Author:** ![stratboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/838e76/32.png) [@stratboy](https://www.ruby-forum.com/u/stratboy)\
**Post date:** [February 28, 2008, 12:34pm UTC](https://www.ruby-forum.com/t/redirect-but-without-change-the-address/130398/5 "2008-02-28T12:34:28Z")

</div>

Luca R. wrote:

> mmm and how i can to passing an id to template?
> 
> ex. i want to render “controller/action/10”

There are several ways to pass parameters between actions  
during one request: controller instance variables, writing  
to the params hash, method parameters (use defaults to ensure  
it works with no arguments), and flash.now.

–  
We develop, watch us RoR, in numbers too big to ignore.
