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 -- Posted via http://www.ruby-forum.com/.
I think all you need to do is: layout "yourlayout" on each controller Frank ----- Original Message ----- From: "mizage" <estettler-O5WfVfzUwx8@public.gmane.org> To: <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> Sent: Friday, December 16, 2005 11:17 AM Subject: [Rails] sharing layout code among different controllers>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 > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
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" -- Posted via http://www.ruby-forum.com/.
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 On 16-Dec-05, at 9:17 AM, mizage wrote:> 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 > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails