Hi: If I have four controllers and I want them to use a common layout, I believe there is a way to do that, I read about it once. To have one layout that covers all the controllers in an application. Could someone kindly tell me how that is done? do you create a single rhtml file called application. rhtml and drop it at the root level of the view controller? bruce
Hi Bruce, I think in you ApplicationController you would put layout :somelayout eg class ApplicationController < ActionController::Base layout :somelayout other stuff end Cheers On 12/2/05, Bruce Balmer <brucebalmer-ee4meeAH724@public.gmane.org> wrote:> > Hi: > > If I have four controllers and I want them to use a common layout, I > believe there is a way to do that, I read about it once. To have one > layout that covers all the controllers in an application. > > Could someone kindly tell me how that is done? do you create a > single rhtml file called application. rhtml and drop it at the root > level of the view controller? > > > bruce > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On Thu, Dec 01, 2005 at 09:35:30PM -0700, Bruce Balmer wrote:> Hi: > > If I have four controllers and I want them to use a common layout, I > believe there is a way to do that, I read about it once. To have one > layout that covers all the controllers in an application. > > Could someone kindly tell me how that is done? do you create a > single rhtml file called application. rhtml and drop it at the root > level of the view controller?Yes, create a layout called application.rhtml. The conventions for layouts, among several, include looking for a layout with the same name as the current controller. Then, looking for one called application.rhtml. Put it in app/views/layouts. If you go off of the naming convention then you must not use the "layout" macro in your controller. marcel -- Marcel Molina Jr. <marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org>
Bruce Balmer
2005-Dec-02 05:12 UTC
I have answered my own question - in case it is useful to anyone
The answer - straight from the Agile Web Dev book is: If you create a layout called application in the layouts directory, it will be applied to all controllers that don’t otherwise have a layout defined for them. bruce On 1-Dec-05, at 9:35 PM, Bruce Balmer wrote:> Hi: > > If I have four controllers and I want them to use a common layout, > I believe there is a way to do that, I read about it once. To have > one layout that covers all the controllers in an application. > > Could someone kindly tell me how that is done? do you create a > single rhtml file called application. rhtml and drop it at the root > level of the view controller? > > > bruce > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Bruce Balmer
2005-Dec-02 05:12 UTC
I have answered my own question - in case it is useful to anyone
The answer - straight from the Agile Web Dev book is: If you create a layout called application in the layouts directory, it will be applied to all controllers that don’t otherwise have a layout defined for them. bruce On 1-Dec-05, at 9:35 PM, Bruce Balmer wrote:> Hi: > > If I have four controllers and I want them to use a common layout, > I believe there is a way to do that, I read about it once. To have > one layout that covers all the controllers in an application. > > Could someone kindly tell me how that is done? do you create a > single rhtml file called application. rhtml and drop it at the root > level of the view controller? > > > bruce > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Thank you Marcel. On 1-Dec-05, at 9:49 PM, Marcel Molina Jr. wrote:> On Thu, Dec 01, 2005 at 09:35:30PM -0700, Bruce Balmer wrote: >> Hi: >> >> If I have four controllers and I want them to use a common layout, I >> believe there is a way to do that, I read about it once. To have one >> layout that covers all the controllers in an application. >> >> Could someone kindly tell me how that is done? do you create a >> single rhtml file called application. rhtml and drop it at the root >> level of the view controller? > > Yes, create a layout called application.rhtml. The conventions for > layouts, > among several, include looking for a layout with the same name as > the current > controller. Then, looking for one called application.rhtml. Put it in > app/views/layouts. If you go off of the naming convention then you > must not > use the "layout" macro in your controller. > > marcel > -- > Marcel Molina Jr. <marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org> > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails