Sha256: d494d88c0623aaf3937d78b17936be8b843d812efa0eb85d28918349ae0f9267
Contents?: true
Size: 722 Bytes
Versions: 182
Compression:
Stored size: 722 Bytes
Contents
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base def ensure_logged_in unless session[:logged_in] respond_to do |accepts| accepts.html do flash[:error] = 'What do you think you\'re doing?' redirect_to '/' end accepts.xml do headers["Status"] = "Unauthorized" headers["WWW-Authenticate"] = %(Basic realm="Web Password") render :text => "Couldn't authenticate you", :status => '401 Unauthorized' end end return false end return true end end
Version data entries
182 entries across 61 versions & 10 rubygems