# Nesting content from multiple controllers

**URL:** <https://www.ruby-forum.com/t/nesting-content-from-multiple-controllers/74730>\
**Category:** Rails\
**Created:** [November 7, 2006, 10:54am UTC](https://www.ruby-forum.com/t/nesting-content-from-multiple-controllers/74730 "2006-11-07T10:54:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kristersaurus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ccd318/32.png) [@kristersaurus](https://www.ruby-forum.com/u/kristersaurus)\
**Post date:** [November 7, 2006, 10:54am UTC](https://www.ruby-forum.com/t/nesting-content-from-multiple-controllers/74730/1 "2006-11-07T10:54:15Z")

</div>

Hi guys.

Here’s something I’ve been struggling with for a while: if you want to  
nest a login box on, say, a welcome page, but the login stuff is  
handled by the login controller while the welcome page is the welcome  
controller, what are your options? Iframe?

Krister

---

<div class="post-metadata">

**Author:** ![kristersaurus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ccd318/32.png) [@kristersaurus](https://www.ruby-forum.com/u/kristersaurus)\
**Post date:** [November 7, 2006, 10:54am UTC](https://www.ruby-forum.com/t/nesting-content-from-multiple-controllers/74730/2 "2006-11-07T10:54:54Z")

</div>

why would you need iframes ? a page can show as many objects from as  
many  
models as you like. just try it. load the objects in your welcome  
controller, thats all

–  
Heri R.  
[http://sprinj.com](http://sprinj.com)

---

<div class="post-metadata">

**Author:** ![kristersaurus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ccd318/32.png) [@kristersaurus](https://www.ruby-forum.com/u/kristersaurus)\
**Post date:** [November 7, 2006, 10:57am UTC](https://www.ruby-forum.com/t/nesting-content-from-multiple-controllers/74730/3 "2006-11-07T10:57:20Z")

</div>

thanks for the reply.

im talking about controller logic, not models. if login is handled by  
functions on the login controller, other than putting that logic in the  
application.rb controller, how can you integrate login functionality  
on a page associated with a different controller?

---

<div class="post-metadata">

**Author:** ![kristersaurus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ccd318/32.png) [@kristersaurus](https://www.ruby-forum.com/u/kristersaurus)\
**Post date:** [November 7, 2006, 10:57am UTC](https://www.ruby-forum.com/t/nesting-content-from-multiple-controllers/74730/4 "2006-11-07T10:57:20Z")

</div>

On 11/3/06, kristersaurus [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> thanks for the reply.
> 
> im talking about controller logic, not models. if login is handled by  
> functions on the login controller, other than putting that logic in the  
> application.rb controller, how can you integrate login functionality  
> on a page associated with a different controller?

I control these things via a partial. You probably want to make any  
variables that the login forms needs via a before\_filter if you need  
that.

If you wanted ajaxy login included on other pages, then use the  
responds\_to  
in your login method of the login controller to provide the correct  
output.

Hope that helps

---

<div class="post-metadata">

**Author:** ![kristersaurus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ccd318/32.png) [@kristersaurus](https://www.ruby-forum.com/u/kristersaurus)\
**Post date:** [November 17, 2006, 7:45pm UTC](https://www.ruby-forum.com/t/nesting-content-from-multiple-controllers/74730/5 "2006-11-17T19:45:09Z")

</div>

Yes, slurpy, thats kind of what im thinking.

Surely theres a solution to this? a good one?

---

<div class="post-metadata">

**Author:** ![kristersaurus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ccd318/32.png) [@kristersaurus](https://www.ruby-forum.com/u/kristersaurus)\
**Post date:** [November 17, 2006, 7:02pm UTC](https://www.ruby-forum.com/t/nesting-content-from-multiple-controllers/74730/6 "2006-11-17T19:02:56Z")

</div>

You can’t really use partials that involve the login controller from a  
view driven by the welcome controller. render :partial doesn’t allow  
you to specify another controller. You’d have to use render\_component,  
and then we’re talking about using components, which is supposedly evil  
& slow.

Right?
