Module: Cartify::CurrentSession

Extended by:
ActiveSupport::Concern
Defined in:
app/concerns/cartify/current_session.rb

Instance Method Summary collapse

Instance Method Details

#cartify_authenticate_user!Object



29
30
31
32
# File 'app/concerns/cartify/current_session.rb', line 29

def cartify_authenticate_user!
  return unless respond_to?("Authenticate#{Cartify.user_class}!".underscore)
  public_send "Authenticate#{Cartify.user_class}!".underscore
end

#cartify_current_userObject



24
25
26
27
# File 'app/concerns/cartify/current_session.rb', line 24

def cartify_current_user
  return unless respond_to?(devise_current_user_method)
  @cartify_current_user ||= public_send(devise_current_user_method)
end

#current_orderObject



20
21
22
# File 'app/concerns/cartify/current_session.rb', line 20

def current_order
  @current_order ||= Cartify::Order.find_or_initialize_by(id: order_id).decorate
end