Class: Spree::CheckoutController
- Inherits:
-
StoreController
- Object
- ApplicationController
- StoreController
- Spree::CheckoutController
- Includes:
- Spree::Checkout::AddressBook
- Defined in:
- app/controllers/spree/checkout_controller.rb
Overview
This is somewhat contrary to standard REST convention since there is not actually a Checkout object. There’s enough distinct logic specific to checkout which has nothing to do with updating an order that this approach is waranted.
Instance Method Summary collapse
-
#update ⇒ Object
Updates the order and advances to the next state (when possible.).
Methods inherited from StoreController
#account_link, #api_tokens, #cart_link, #ensure_cart
Instance Method Details
#update ⇒ Object
Updates the order and advances to the next state (when possible.)
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/spree/checkout_controller.rb', line 33 def update if @order.update_from_params(params, permitted_checkout_attributes, request.headers.env) @order.temporary_address = !params[:save_user_address] unless @order.next flash[:error] = @order.errors..join("\n") redirect_to(spree.checkout_state_path(@order.state)) && return end if @order.completed? @current_order = nil flash['order_completed'] = true redirect_to completion_route else redirect_to spree.checkout_state_path(@order.state) end else render :edit, status: :unprocessable_entity end end |