From: Brock Weaver Date: 2005-08-13T05:48:33+09:00 Subject: Layouts in Rails... ------=_Part_4693_10897249.1123879708752 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I apologize if this the incorrect mailing list, as it is a Rails question,= =20 not really a Ruby question. Anyway: To apply a layout to a controller, you can say: class UsersController < ApplicationController layout "master" end ...which you would need to do in every controller. So my first thought is t= o=20 push this down into ApplicationController, mitigating the need to put=20 anything layout related in all the other controllers: class ApplicationController < ActionController::Base layout "master" end ...which doesn't work. So my next thought is to declare an instance variabl= e=20 in the ApplicationController: class ApplicationController < ActionController::Base @layout =3D "master" end and change all other controllers to look like this: class UsersController < ApplicationController layout @layout end ...which doesn't work either. So I grudgingly try a global with the same=20 thought process: class ApplicationController < ActionController::Base $layout =3D "master" end class UsersController < ApplicationController layout $layout end ...which works. But I don't understand why, if UsersController derives from= =20 ApplicationController, the other two methodologies fail. Can someone explai= n=20 this to me?=20 Centralizing the layout moniker to one place will help significantly as I= =20 move my app from test/dev/prod, so I can have alarmingly different layouts= =20 for test/dev versus production. --=20 Brock Weaver http://www.circaware.com ------=_Part_4693_10897249.1123879708752--