Forum: Ruby on Rails sharing partials across controllers.

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.
036be8d5d83a98e546b98d64e3fd6c20?d=identicon&s=25 Sam Donaldson (Guest)
on 2006-05-30 11:14
(Received via mailing list)

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

And help would be appreciated.
882cc23c77c5c6d27613c51396a02a0d?d=identicon&s=25 Stephen Bartholomew (Guest)
on 2006-05-30 11: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,

This topic is locked and can not be replied to.