Having to explicitly render :layout => 'application' in controller actions in my Rails 3 app
I am having to explicitly render :layout => 'application' in my controller actions in order to get my new rails 3 app to actually use the application.html.erb layout file.
Any obv开发者_StackOverflowious things to look for that I am doing wrong? If I don't call the :layout option it just doesn't render the layout. I get a message like:
Processing by FooController#index as HTML
...when I read the terminal window trace on WEBrick
I know this is resing a dead thread but I recently ran into the same issue. My controller was inheriting from ActionController::Base and not ApplicationController. I had the same issue as you were having, until I fixed that.
I ran into the same issue, the problem ended up being that someone had defined an initialize method for the controller.
I experienced the same problem with an app upgraded from Rails 2.3.8 to 3.0.3. In my case, all controllers except one rendered properly with the app/views/layouts/application.html.haml. When I finally added render :layout => 'application'
, the non-conforming controller rendered properly.
精彩评论