Class: Front::Devise::RegistrationsController

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

Instance Method Summary collapse

Instance Method Details

#after_sign_up_path_for(resource) ⇒ Object



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

def (resource)
  if 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
    session.delete(:cart_id)
  end
  params['checkout'] ? new_checkout_path : super
end