views:

29

answers:

4

For one of my controllers, all of the views are displaying without the application layout. The application layout works fine for every other controller & view in the application.

Here is a controller whose views display the application template (note: I've made all of the views empty to simplify matters)

class PagesController < ApplicationController  
  def home
    @title = "Home"
  end  
end

And here is the controller whose views won't display the application layout (again, the view itself it empty)

class PersonalentriesController < ApplicationController
  def index
    @personalentries = current_user.personalentries.all
  end
end

What could be causing this? Thanks for reading

+1  A: 

Take a look at your app/views/layouts/ folder. You probably have pages.html.erb there, but not personalentries.html.erb Create personalentries.html.erb in that folder (copypaste from pages.html.erb and modify accordingly). It will work :)

buru
That was it. Haven't used scaffold in awhile and forgot it did that. Thanks for your help!
ben
A: 

can you check layout "some thing" in your controller .

+1  A: 

yeah, i guess @buru is right. You must have scaffolded and it generated a layout for that particular controller.

Suman Mukherjee
A: 

The best thing you can do is to create an applciation.html.erb in your layouts folder This layout will applied to all html views except if you specify else (not to render it or render another one)

PanosJee