I have a Ruby on Rails app with an admin section, as is common for a lot of apps. The admin section is namespaced, so all of the controllers are named something like
Admin::WidgetsController and the routes all start with
Now, there is no reason, ever, for a non-admin user to do anything in the admin section, so I created an
Admin::ApplicationController and put a
before_filter in it to redirect requests from non-admin users to the admin login page. Then, I had all of my
Admin:: controllers inherit from it.
So I’m all set, right?