Class: Checkout::ShippingAddressesController
- Inherits:
-
SimplyController
- Object
- SimplyController
- Checkout::ShippingAddressesController
- Defined in:
- app/controllers/nimbleshop_simply/checkout/shipping_addresses_controller.rb
Instance Method Summary collapse
Instance Method Details
#new ⇒ Object
6 7 8 9 10 11 12 |
# File 'app/controllers/nimbleshop_simply/checkout/shipping_addresses_controller.rb', line 6 def new current_order.initialize_addresses @countries = current_order.shippable_countries if @countries.blank? render text: "Shipping options are not configured for this order. Please contact shop administrator" end end |
#update ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/nimbleshop_simply/checkout/shipping_addresses_controller.rb', line 14 def update if params[:order][:shipping_address_attributes][:use_for_billing] == '1' current_order.billing_address_same_as_shipping = true else current_order.billing_address_same_as_shipping = false end if current_order.update_attributes(params[:order].merge(validate_email: true)) redirect_to new_checkout_shipping_method_path else @countries = ShippingMethod.available_for_countries(current_order.line_items_total) current_order.initialize_addresses render action: :new end end |