Forum: Ruby on Rails Rendering partials on another controller

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
ivanvega (Guest)
on 2005-11-23 03:22
(Received via mailing list)

I was trying to include a view inside my application.rhtml layout, and I
found that render_component seemed to be the answer. Unfortunately, it
doesn't understand the ":layout => false" option (like a normal render),
and also doesn't seem to be able to render partials at all.

So is there a way to do what I'm trying? short of using a custom layout
on this "component" and deleting the default one?

I also tried using "render" directly inside the layout, but it doesn't
output anything at all.

Thanks in advance!

Ivan V.
nicholas.stuart (Guest)
on 2005-11-23 15:00
(Received via mailing list)
If you have a partial in say, 'app/views/users/_form.rhtml' and you want
render this from anywhere in your app you could use:
render :partial=>"/users/form"
This will hopefully give you what you want. And since its a partial, you
don't need to use layout=>false. The render_components method is for
rendering controllers/views from the components directory and is quite

Hope this helps!
ivanvega (Guest)
on 2005-11-23 17:26
(Received via mailing list)
I should have guessed it would be so simple... Thanks a lot!

Ivan V.
nicholas.stuart (Guest)
on 2005-11-23 17:38
(Received via mailing list)
No problem. I still find myself trying to make things to complicated as
well. :)
This topic is locked and can not be replied to.