To explicitly display: layout => 'application' in controller actions in my Rails 3 application

I need to explicitly map: layout => 'application' in my controller actions in order to get my new rails 3 application to actually use the layout file application.html.erb.

Any obvious things to look for what I'm doing wrong? If I do not name the option: layout, it just does not display the layout. I get a message like:

FooController # Index Processing as HTML

... when I read the terminal window trace on WEBrick

+4
source share
3 answers

I had the same problem with an application upgraded from Rails 2.3.8 to 3.0.3. In my case, all but one of the controllers is correctly displayed using the /views/layouts/application.html.haml application. When I finally added render :layout => 'application' , the inappropriate controller displayed correctly.

+2
source

I know this is reloading a dead thread, but I recently ran into the same problem. My controller inherited from ActionController :: Base, not ApplicationController. I had the same problem as yours until I fixed it.

+14
source

I ran into the same problem, the problem is that someone defined an initialization method for the controller.

+8
source

All Articles