Class: Spree::Admin::Orders::CustomerDetailsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Spree::Admin::Orders::CustomerDetailsController
- Includes:
- Spree::Admin::OrderConcern
- Defined in:
- app/controllers/spree/admin/orders/customer_details_controller.rb
Instance Method Summary collapse
Instance Method Details
#edit ⇒ Object
15 16 17 18 |
# File 'app/controllers/spree/admin/orders/customer_details_controller.rb', line 15 def edit @order.build_bill_address(country: current_store.default_country) if @order.bill_address.nil? @order.build_ship_address(country: current_store.default_country) if @order.ship_address.nil? end |
#show ⇒ Object
10 11 12 13 |
# File 'app/controllers/spree/admin/orders/customer_details_controller.rb', line 10 def show edit render action: :edit end |
#update ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/spree/admin/orders/customer_details_controller.rb', line 20 def update params[:order][:user_id] = nil if guest_checkout? if @order.update(order_params) @order.associate_user!(@user, @order.email.blank?) unless guest_checkout? @order.next if @order.address? @order.refresh_shipment_rates(Spree::ShippingMethod::DISPLAY_ON_BACK_END) if @order.errors.empty? flash[:success] = Spree.t('customer_details_updated') redirect_to spree.edit_admin_order_url(@order) else render action: :edit, status: :unprocessable_entity end else render action: :edit, status: :unprocessable_entity end end |