I want to have one layout for my whole application. The app has multiple controllers. Is it true that layouts are associated w/ one controller? thanks, etienne
on 2005-12-16 18:17
on 2005-12-16 18:21
I think all you need to do is: layout "yourlayout" on each controller Frank ----- Original Message ----- From: "mizage" <email@example.com> To: <firstname.lastname@example.org> Sent: Friday, December 16, 2005 11:17 AM Subject: [Rails] sharing layout code among different controllers
on 2005-12-16 18:26
ok just found the solution. According to the agile web dev book it says "If you create a layout call 'application' in the 'layouts' directory, it will be applied to all controllers that don't otherwise have a layout defined for them"
on 2005-12-16 18:54
Yes. But there is a solution. Make a layout called application.rhtml and drop it in the root of the layouts folder. Your app always checks for the existence of that file. There is a potential gotcha here. If you also have a controller specific layout (made automatically by scaffolding) it will OVERRIDE the application.rhtml file. bruce