# How to render from a different controller

**URL:** <https://www.ruby-forum.com/t/how-to-render-from-a-different-controller/52473>\
**Category:** Rails\
**Created:** [January 14, 2006, 9:11pm UTC](https://www.ruby-forum.com/t/how-to-render-from-a-different-controller/52473 "2006-01-14T21:11:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nekapoor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ea666f/32.png) [@nekapoor](https://www.ruby-forum.com/u/nekapoor)\
**Post date:** [January 14, 2006, 9:11pm UTC](https://www.ruby-forum.com/t/how-to-render-from-a-different-controller/52473/1 "2006-01-14T21:11:00Z")

</div>

My code is something like this.

class FirstController \< ApplicationController

def foo  
#some processing  
render (:controller =\> ‘second’, :action =\> ‘index’)  
end

end

I tried using both render and redirect but it seems it’s not possible to  
send the control from within a controller to some other controller. Am  
I  
missing something here?

Thanks.  
-=- Neeraj

---

<div class="post-metadata">

**Author:** ![nekapoor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ea666f/32.png) [@nekapoor](https://www.ruby-forum.com/u/nekapoor)\
**Post date:** [January 14, 2006, 9:17pm UTC](https://www.ruby-forum.com/t/how-to-render-from-a-different-controller/52473/2 "2006-01-14T21:17:01Z")

</div>

Are your redirect\_to or render statements the last line in your  
controller  
method that is performing the redirect? Are you always redirecting, or  
doing it conditionally? redirect\_to and render do not return a value,  
so  
your controller method will continue to run after calling them (if there  
are  
additional statements to process), unless you do something like the  
following:

redirect\_to :controller =\> ‘controller’, :action =\> ‘myAction’ and  
return

I’m a relative rails newb, so I could be horribly misleading you, but I  
ran  
into a similar problem and the above suggestion took care of it…  
hopefully someone with more experience can weigh in here for a  
definitive  
answer.

-Will
