Where to put partials called from the application layout


#1

Hello,

My main application layout, app/views/layout/application.rhtml looks
like this:

something
render partial_1
something else
render partial_2
something else
render partial_3

The partials are not really doing anything, i use them to keep the
layout modular (i.e . to have ~30 lines instead of 200). Now, the
question is where to put _partial_1.rhtml, _partial_2.rhtml,
_partial_3.rhtml.
If i am putting them to app/views/layouts, they are not found when a
view using this layout (e.g. view of the controller foo) is rendered -
but i don’t want to put them into app/views/layouts/foo/ either since if
i am going to use the same layout to render the controller bar, i will
have to copy them there too, which not DRY.
I am quite sure this is a noob question, so what is the standard way to
do this?

TIA,
Peter


#2

On Sunday, May 21, 2006, at 9:14 PM, Peter S. wrote:

render partial_3
I am quite sure this is a noob question, so what is the standard way to
do this?

TIA,
Peter


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

create a directory called ‘shared’ in your view path.

then call them as ‘shared/partial1’ and they should all go to the same
place.

_Kevin


#3

Kevin,

create a directory called ‘shared’ in your view path.

then call them as ‘shared/partial1’ and they should all go to the same place.

Thx a lot, i have been thinking about this too, just have been wondering
what’s the standard way of doing it since something like this (AFAIK)
was not discussed in the AWDwR book. So thanks again.

Cheers,
Peter


#4

On Sunday, May 21, 2006, at 9:36 PM, Peter S. wrote:

Cheers,
Peter


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

If you look carefully, you will see that AWDwR does mention shared
partials.

_Kevin