Sha256: d946b3e10181f22d22e4c30b5d9df6165293c9b6847183c8057e8763cb4895bd

Contents?: true

Size: 786 Bytes

Versions: 7

Compression:

Stored size: 786 Bytes

Contents

module Fume
  module Authlogic
    def self.try_enable(app)
      if defined? ::Authlogic
        ActionController::Base.send :include, ControllerExtensions
      end
    end
    
    module ControllerExtensions
      extend ActiveSupport::Concern
      
      included do
        helper_method :current_user_session, :current_user
      end
      
      module InstanceMethods
        
        protected
        def current_user_session
          return @current_user_session if defined?(@current_user_session)
          @current_user_session = UserSession.find
        end

        def current_user
          return @current_user if defined?(@current_user)
          @current_user = current_user_session && current_user_session.user
        end
        
      end
    end
  end
end


Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fume-0.8.1a lib/fume/authlogic.rb
fume-0.8.0 lib/fume/authlogic.rb
fume-0.8.0b lib/fume/authlogic.rb
fume-0.8.0a lib/fume/authlogic.rb
fume-0.7.2 lib/fume/authlogic.rb
fume-0.7.1 lib/fume/authlogic.rb
fume-0.7.0 lib/fume/authlogic.rb