Class: Bodega::OrdersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Bodega::OrdersController
- Defined in:
- app/controllers/bodega/orders_controller.rb
Instance Method Summary collapse
Instance Method Details
#add ⇒ Object
6 7 8 9 10 11 |
# File 'app/controllers/bodega/orders_controller.rb', line 6 def add if product = params[:order_product] update_cart(product) end redirect_to new_order_path end |
#complete ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'app/controllers/bodega/orders_controller.rb', line 13 def complete if current_order.finalize!(params) session.delete(:bodega_order_id) redirect_to order_path(current_order), notice: t('bodega.order_processed') else redirect_to new_order_path, error: t('bodega.order_failed') end end |
#create ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/bodega/orders_controller.rb', line 22 def create if current_order.update_attributes(params[:order].merge(checking_out: params[:checkout].present?)) if !current_order.new_shipping_rates? && params[:checkout] redirect_to current_order.payment_method.checkout_url(complete_order_url, new_order_url, params) else redirect_to new_order_path end else render :new end end |
#remove ⇒ Object
34 35 36 37 |
# File 'app/controllers/bodega/orders_controller.rb', line 34 def remove current_order.remove_product params[:product_id] redirect_to :back end |
#show ⇒ Object
39 40 41 |
# File 'app/controllers/bodega/orders_controller.rb', line 39 def show render :edit unless @order.complete? end |