Shared Partial Folder Inheritance

I am rendering the partial “shared/list” from within a controller.
This partial in turn renders the partial “shared/listitem”.

My question is:

Is there an option for render to inherit the location of the called
partial so i can call the partial ‘listitem’, or must i specify the
sub-partial as ‘shared/listitem’. i.e. relative as opposed to
absolute.

If not, can you think of a reason why this would be? It seems a
nuisance to code all shared or cross-controller views with absolute
locations and could provide problems with future application
expansions.

Any thoughts on the best-practice way to overcome this?

Matt Williams

On Feb 10, 2008, at 8:54 AM, Matt wrote:

If not, can you think of a reason why this would be? It seems a
nuisance to code all shared or cross-controller views with absolute
locations and could provide problems with future application
expansions.

Any thoughts on the best-practice way to overcome this?

I create an instance var in application.rb which is a hash of paths I
will use throughout the application. I use that for all path
references. If I need to relocate things, there’s one place to make
that change.

I have a number of tibits for dealing with partials and layouts in an
article here:

http://www.railsdev.ws/blog/3/modular-page-assembly-in-rails/


def gw
writes_at ‘www.railsdev.ws’
end