Forum: Ruby on Rails sharing partials across controllers.

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.
Sam D. (Guest)
on 2006-05-30 13:14
(Received via mailing list)
Hi,

I was wondering if it is possible to share a partial across views in
different controllers?  If so, how would I go about doing this?  Would I
pass in a parameter to render(...) of the partial telling it where it is
located?

And help would be appreciated.
Stephen B. (Guest)
on 2006-05-30 13:17
(Received via mailing list)
Say you have a basket view partial that you want to use from other
views.  You can do it like this:

render(:partial => 'basket/view')

Basically, if the argument has a slash, it'll treat look for the partial
from the root of the views directory.

Hope that helps,

Steve
This topic is locked and can not be replied to.