Sha256: 1cd099a3f1542734467bd7f0aff446e26106dd01b9b125654e09c5936f815486

Contents?: true

Size: 781 Bytes

Versions: 7

Compression:

Stored size: 781 Bytes

Contents

module Fume
  module Authlogic
    def self.try_enable
      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.6.7 lib/fume/authlogic.rb
fume-0.6.6 lib/fume/authlogic.rb
fume-0.6.4 lib/fume/authlogic.rb
fume-0.6.3 lib/fume/authlogic.rb
fume-0.6.2 lib/fume/authlogic.rb
fume-0.6.1 lib/fume/authlogic.rb
fume-0.6.0 lib/fume/authlogic.rb