Forum: Ruby on Rails Rendering partials on another controller

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C5380b957ff8ce5cb14cf2282ffeb720?d=identicon&s=25 ivanvega (Guest)
on 2005-11-23 02:22
(Received via mailing list)
Hi,

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.
Cb610750ee94ca103aef4b2dc7b1b768?d=identicon&s=25 nicholas.stuart (Guest)
on 2005-11-23 14:00
(Received via mailing list)
If you have a partial in say, 'app/views/users/_form.rhtml' and you want
to
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
different.

Hope this helps!
-Nick
C5380b957ff8ce5cb14cf2282ffeb720?d=identicon&s=25 ivanvega (Guest)
on 2005-11-23 16:26
(Received via mailing list)
I should have guessed it would be so simple... Thanks a lot!

Ivan V.
Cb610750ee94ca103aef4b2dc7b1b768?d=identicon&s=25 nicholas.stuart (Guest)
on 2005-11-23 16: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.