Sha256: 215ec0311707aeb6302036c8a6038eb0c10346a253c443fd323cd13c042ec3ca

Contents?: true

Size: 851 Bytes

Versions: 111

Compression:

Stored size: 851 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
  # Pick a unique cookie name to distinguish our session data from others'
  session :session_key => '_rails_root_session_id'
  
  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

111 entries across 111 versions & 23 rubygems

Version Path
Flamefork-shoulda-2.10.1 test/rails_root/app/controllers/application.rb
Flamefork-shoulda-2.10.2 test/rails_root/app/controllers/application.rb
auser-poolparty-1.3.0 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.1 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.10 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.11 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.12 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.13 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.14 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.15 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.16 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.17 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.2 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.3 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.4 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.5 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.6 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.7 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
auser-poolparty-1.3.8 vendor/gems/shoulda/test/rails_root/app/controllers/application_controller.rb
carlosbrando-remarkable-0.0.99 spec/rails_root/app/controllers/application.rb