Class: SimpleCart::CheckoutController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SimpleCart::CheckoutController
- Includes:
- Wicked::Wizard
- Defined in:
- app/controllers/simple_cart/checkout_controller.rb
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/simple_cart/checkout_controller.rb', line 9 def show case step when :delivery jump_to(:billing) if @order.shipping_address.nil? when :payment jump_to(:delivery) if @order.delivery.nil? when :confirm jump_to(:payment) if @order.credit_card.nil? end @order.build_or_find_billing_address @order.build_or_find_shipping_address @order.build_or_find_credit_card render_wizard end |
#update ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/simple_cart/checkout_controller.rb', line 24 def update case step when :billing if @order.update(order_params) && !params[:shipping].nil? @order.build_shipping_address.attributes = @order.billing_address.attributes.except("id", "type", "user_id") jump_to(:delivery) end when :shipping @order.update(order_params) when :delivery @order.delivery = Delivery.find(params[:order][:delivery_id]) when :payment @order.update(order_params) end render_wizard @order end |