Best way to use partial rendering in global layout

I have a global layout in application.rhtml and I’d like to render a
partial template within it.

Currently, I have this:

<%= render (:partial => ‘side_nav’) %>

but it seems to be looking in the controller specific view directory.

What is the best way to do handle controller - global partial rendering?

Wes

ANSWER:
Create a “shared” directory under app/views and do:

<%= render ( :partial => ‘shared/side_nav’ ) %>

THANKS DAVE THOMAS!

Wes

Wes G. wrote:

I have a global layout in application.rhtml and I’d like to render a
partial template within it.

Currently, I have this:

<%= render (:partial => ‘side_nav’) %>

but it seems to be looking in the controller specific view directory.

What is the best way to do handle controller - global partial rendering?

Wes

What if you want to use a global partial most of the time, but sometimes
want
to override it?

Would it add any value to have rails check the controller specific
directory
first, and then automatically look in shared/global/layouts/whatever if
not
found? Seems intuitive to me, but may just mean higher complexity with
no
real gain.

View this message in context:
http://www.nabble.com/Best-way-to-use-partial-rendering-in-global-layout-t1275884.html#a3393886
Sent from the RubyOnRails Users forum at Nabble.com.

I think that’s how it works now, actually.

I scaffolded a new controller and the default layout that was generated
got used until I removed it, and then the global one got used.

Wes

Lucifron wrote:

What if you want to use a global partial most of the time, but sometimes
want
to override it?

Would it add any value to have rails check the controller specific
directory
first, and then automatically look in shared/global/layouts/whatever if
not
found? Seems intuitive to me, but may just mean higher complexity with
no
real gain.

View this message in context:
http://www.nabble.com/Best-way-to-use-partial-rendering-in-global-layout-t1275884.html#a3393886
Sent from the RubyOnRails Users forum at Nabble.com.

Wes G. wrote:

I think that’s how it works now, actually.

I scaffolded a new controller and the default layout that was generated
got used until I removed it, and then the global one got used.

Wes
Layouts work this way, yes, but not partials.


View this message in context:
http://www.nabble.com/Best-way-to-use-partial-rendering-in-global-layout-t1275884.html#a3401727
Sent from the RubyOnRails Users forum at Nabble.com.

That’s right.

I don’t know - I think someone would find a good use for that feature
with partials.

Wes

Lucifron wrote:

Wes G. wrote:

I think that’s how it works now, actually.

I scaffolded a new controller and the default layout that was generated
got used until I removed it, and then the global one got used.

Wes
Layouts work this way, yes, but not partials.


View this message in context:
http://www.nabble.com/Best-way-to-use-partial-rendering-in-global-layout-t1275884.html#a3401727
Sent from the RubyOnRails Users forum at Nabble.com.