Sha256: ac73e387f3ebb56479351af8f674d3f7aa55e9ec808d50b535b8e2e80c6208f9

Contents?: true

Size: 484 Bytes

Versions: 1

Compression:

Stored size: 484 Bytes

Contents

module Socialite
  module Controllers
    module Helpers
      extend ActiveSupport::Concern

      included do
        helper_method :current_user, :user_signed_in?
      end

      def current_user
        @current_user ||= Socialite.user_class.find(session[:user_id])
      end

      def user_signed_in?
        !!current_user
      end

      def current_user=(user)
        @current_user = user
        session[:user_id] = user.nil? ? user : user.id
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
socialite-0.1.0.pre.3 lib/socialite/controllers/helpers.rb