Reputation: 29777
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
Upvotes: 0
Views: 78
Reputation: 3866
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)
Upvotes: 0
Reputation: 205
yeah, i guess @buru is right. You must have scaffolded and it generated a layout for that particular controller.
Upvotes: 1
Reputation: 3210
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 :)
Upvotes: 1