Richard Jordan
Richard Jordan

Reputation: 8202

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 obvious 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

Upvotes: 4

Views: 3459

Answers (3)

sfaxon
sfaxon

Reputation: 551

I ran into the same issue, the problem ended up being that someone had defined an initialize method for the controller.

Upvotes: 8

danhere
danhere

Reputation: 680

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.

Upvotes: 14

Doc
Doc

Reputation: 52

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.

Upvotes: 2

Related Questions