Rails Controllers
I’m starting a new rails app, using Rails4, and am trying to do more things by hand instead of depending on generators. I actually think generators are great, but I want to better understand how all the parts fit together. So I want to know how to do things by hand, instead of depending on the generators.
Yesterday, I made a couple of controllers (home, users and user_sessions). Interestingly, my layout was only working on user_sessions and neither of the others. The problem was in how I set the controllers up. I had this:
class UsersController < ActionController::Base
and it should have been this:
class UsersController < ApplicationController
I found the answer here. From that page, “Controllers other than your ApplicationController need to subclass from ApplicationController in order for their views to be rendered within the application.html.erb layout”