Sha256: 990af62284d681759faac747e86d0febf4662cb655cc8b2496932ac1439d5177

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

basedir = File.dirname(__FILE__)

require 'rack/contrib/cookies'
require 'action_pack'
require 'action_controller'

#Require the files necessary for Rails integration
require 'global_session/rack'
require 'global_session/rails/action_controller_class_methods'
require 'global_session/rails/action_controller_instance_methods'

# Enable ActionController integration.
class <<ActionController::Base
  include GlobalSession::Rails::ActionControllerClassMethods
end

ActionController::Base.instance_eval do
  include GlobalSession::Rails::ActionControllerInstanceMethods
end

module GlobalSession
  module Rails
    def self.activate(config)
      authorities = File.join(::Rails.root, 'config', 'authorities')
      hgs_config  = ActionController::Base.global_session_config
      hgs_dir     = GlobalSession::Directory.new(hgs_config, authorities)

      # Add our middleware to the stack.
      config.middleware.use ::Rack::Cookies
      config.middleware.use ::Rack::GlobalSession, hgs_config, hgs_dir

      return true
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
global_session-1.0.8 lib/global_session/rails.rb
global_session-1.0.7 lib/global_session/rails.rb
global_session-1.0.6 lib/global_session/rails.rb
global_session-1.0.5 lib/global_session/rails.rb
global_session-1.0.4 lib/global_session/rails.rb
global_session-1.0.3 lib/global_session/rails.rb
global_session-1.0.2 lib/global_session/rails.rb
global_session-1.0.0 lib/global_session/rails.rb