Rail layout not displayed

I updated one of my applications from rails to 2.3.2 from 2.0.2. To start searching. However, as soon as I start launching any pages, the page will show, but does not seem to display any layout code. None of the standard tags, such as head, body, which are in the layout, are rendered. It seems that somehow the layout is disabled. I checked the error log and did not find a complaint about the layout. Has anyone seen this?

+4
source share
6 answers

You might have redefined initialize () in your controller so that the layout is ignored.

See: will initialize a break in layout settings in rails?

+7
source

Did you try to set the layout differently? (For debugging only)

render :layout => "mylayout" 

This can help you find typos. Once, a colleague had a place after the layout name "application.html.erb", which we found in this way.

+1
source

See if you have the app/views/layouts/application.html.erb file - this should be your default layout. I'm not sure, but I think that Rails in some version changed the default layout file name, and also somewhere in the past changed the file extension.

+1
source

It's hard to say exactly based on what you provided, but a couple of things you can check:

  • Your layouts have the correct file extensions (.html.erb instead of .rhtml)

  • Does the layout name match the name of the controller or not the name of the layout declared inside the controller

  • I assume that the layouts are in the correct directory of your application (app / views / layouts)

Good luck

0
source

I believe that somewhere between Rails 2.0 and 2.3 the location of ApplicationController has changed from app/controllers/application.rb to app/controllers/application_controller.rb . Is it possible that because of this (or for some other reason) your ApplicationController not loading properly? If so, and if you defined layout in this class, it may not select the default layout.

0
source

Does this affect all controllers?

Unless you are watching app / views / .html.erb, which is probably very empty.

0
source

All Articles