[Rails-core] Re: Location of Nested Controller Layout Files
DeLynn Berry
delynn at gmail.com
Mon Feb 6 17:38:30 GMT 2006
> I think that may cause a little confusion if there's a special check
> for the 'application' layout within subdirectories. I suggest
> making a BaseController from which other controllers inherit in that
> directory...
I agree with you, and your suggestion was how I had solved this
problem previously. I was just trying to eliminate the need for the
layout method for these nested controllers as well (DRYing layout
sharing for nested controllers even more ;-).
> I like your previous suggestion of removing the extraneous
> "controller" directory from the 'layouts' directory. I didn't even
> know that was the current requirement.
I just submitted a patch that fixes this issue and also enhances the
documentation to explain how to get the auto-discovery of layout files
to work with nested controllers. This fix, along with the creation of
a BaseController for each of the nested sections of an application,
creates what I think is a very nice solution to the problem.
If you have an Admin::BaseController < ApplicationController, the
layout that is first looked for is app/views/layouts/admin/base.rhtml.
I really like this solution to layout sharing for nested controllers.
Hopefully it will get applied before 1.1 ships.
--
DeLynn Berry
delynn at gmail.com
http://www.delynnberry.com
More information about the Rails-core
mailing list