Sha256: 65ec89932341e8d9819f45034903f4f12e50da398d753b6bb5a431b76013180b
Contents?: true
Size: 951 Bytes
Versions: 8
Compression:
Stored size: 951 Bytes
Contents
# frozen_string_literal: true module C class Front::Devise::RegistrationsController < Devise::RegistrationsController layout 'c/main_application' def after_sign_up_path_for(resource) if session[:cart_id].present? begin customer = current_front_customer_account.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 private def sign_up_params h = params.require(:front_customer_account).permit( :email, :password, :password_confirmation, customer_attributes: [:name] ) h[:customer_attributes][:email] = h[:email] h end end end
Version data entries
8 entries across 8 versions & 1 rubygems