Class: Front::Devise::SessionsController

Inherits:
Devise::SessionsController
  • Object
show all
Defined in:
app/controllers/c/front/devise/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#after_loginObject



7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/c/front/devise/sessions_controller.rb', line 7

def 
  return unless session[:cart_id].present?
  begin
    customer = .customer
    cart = C::Cart.find(session[:cart_id])
    cart.update(customer_id: customer.id)
    cart.order.update(customer: customer) if cart.order.present?
  rescue ActiveRecord::RecordNotFound
    # Do nothing, as there is nothing to set
  end
end

#after_sign_in_path_for(resource) ⇒ Object



19
20
21
# File 'app/controllers/c/front/devise/sessions_controller.rb', line 19

def (resource)
  request[:checkout] ? new_checkout_path : super
end

#after_sign_out_path_for(_resource_or_scope) ⇒ Object



23
24
25
# File 'app/controllers/c/front/devise/sessions_controller.rb', line 23

def after_sign_out_path_for(_resource_or_scope)
  '/'
end