Rendering partials from other controllers

Hey guys - just a quick question about partials. I’m trying to put
together an administrative console for my site (which is working great,
thanks to the excellent and consistent help I’ve received here). Since
I’m still new at this, I figured the easiest way to get it up and
running quickly would be to use the views that already exist in my
numerous scaffolds. However, since each view and partial resides in a
different directory than the console, I would need to call them in a
different way than just render :partial => ‘partialname’. I tried
plugging in the :controller as an option, but no go. Is what I’m trying
to do even possible? Or even better, is there a better way that I could
be going about this?

Thanks!

Just include the directory name, so if you have
app/views/foo/_foo.rhtml, then:
render :partial=>‘foo/foo’

Cheers!

Sweet! You rock. Thanks!

yep,

1 thing I started doing about a month ago is putting all of my
partials in the layouts directory.

Then, they are all in one place and easy to find later.

Maybe it would make sense to create a partials directory.

The layouts directory is good though. Usually I only have
about 3 or 4 or 5 layouts in there anyway.

-Dan

On 10/9/06, Sean C. [email protected] wrote:

Sweet! You rock. Thanks!


Posted via http://www.ruby-forum.com/.


[email protected]