Forum: Ruby on Rails How can I render a partial from other 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.
7fbd0e99b27064b14793f028022974e5?d=identicon&s=25 Zhao Yi (youhaodeyi)
on 2009-03-31 07:53
I use this code to render a partial:

<%= render :partial=>'test' %>

The test is not located in the current controller. How can I point it to
other place?
36ed63ef68c172f148c491418395d0b5?d=identicon&s=25 David Knorr (Guest)
on 2009-03-31 07:59
(Received via mailing list)
On 31 Mar., 07:53, Zhao Yi <rails-mailing-l...@andreas-s.net> wrote:
> I use this code to render a partial:
>
> <%= render :partial=>'test' %>
>
> The test is not located in the current controller. How can I point it to
> other place?

<%= render :partial => 'people/test' %>

In this case, the name of the controller is PeopleController. See the
documentation for partial rendering:
http://api.rubyonrails.org/classes/ActionView/Partials.html

--
Best regards,
David Knorr
http://twitter.com/rubyguy
This topic is locked and can not be replied to.