# Filters added to this controller will be run for all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base before_filter :check_authentication, :except => [:login] before_filter :find_items def find_items @categories = Category.find(:all) end def check_authentication if params[:controller]["admin"] unless session[:user] session[:intended_action] = action_name session[:intended_controller] = controller_name redirect_to :controller => 'users', :action => 'login' end end end end