# 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 include ApplicationHelper before_filter :check_authorization # Log a user in by authorization cookie if necessary. def check_authorization authorization_token = cookies[:authorization_token] if authorization_token and not logged_in? user = User.find_by_authorization_token(authorization_token) user.login!(session) if user end end # Return true if a parameter corresponding to the given symbol was posted. def param_posted?(sym) request.post? and params[sym] end end