Sha256: 4ae6c4ff128d11a1cd318dc6a607bca11d0d373283dfe2af47c941a5796d9500

Contents?: true

Size: 997 Bytes

Versions: 2

Compression:

Stored size: 997 Bytes

Contents

module Authlogic
  module ControllerAdapters
    # = Merb Adapter
    #
    # Adapts authlogic to work with merb. The point is to close the gap between what authlogic expects and what the merb controller object
    # provides. Similar to how ActiveRecord has an adapter for MySQL, PostgreSQL, SQLite, etc.
    class MerbAdapter < AbstractAdapter
      # = Merb Implementation
      #
      # Lets Authlogic know about the controller object via a before filter, AKA "activates" authlogic.
      module MerbImplementation
        def self.included(klass) # :nodoc:
          klass.before :activate_authlogic
        end

        private
          def activate_authlogic
            Authlogic::Session::Base.controller = MerbAdapter.new(self)
          end
      end
    end
  end
end
 
# make sure we're running inside Merb
if defined?(Merb::Plugins)
  Merb::BootLoader.before_app_loads do
    Merb::Controller.send(:include, Authlogic::ControllerAdapters::MerbAdapter::MerbImplementation)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
authlogic-1.3.8 lib/authlogic/controller_adapters/merb_adapter.rb
authlogic-1.3.9 lib/authlogic/controller_adapters/merb_adapter.rb