Class: Spree::CheckoutController
- Inherits:
-
StoreController
- Object
- BaseController
- StoreController
- Spree::CheckoutController
- 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
#cart_link, #forbidden, #unauthorized
Instance Method Details
#update ⇒ Object
Updates the order and advances to the next state (when possible.)
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/spree/checkout_controller.rb', line 27 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(checkout_state_path(@order.state)) && return end if @order.completed? @current_order = nil flash.notice = Spree.t(:order_processed_successfully) flash['order_completed'] = true redirect_to completion_route else redirect_to checkout_state_path(@order.state) end else render :edit end end |