Class: ShoppingCart::OrdersController
Instance Method Summary
collapse
#create_order_failed, #update_error, #updated_notice
Instance Method Details
#create ⇒ Object
26
27
28
29
30
31
|
# File 'app/controllers/shopping_cart/orders_controller.rb', line 26
def create
CreateOrder.call(params) do
on(:ok) { redirect_to root_path }
on(:invalid) { create_order_failed }
end
end
|
#destroy ⇒ Object
21
22
23
24
|
# File 'app/controllers/shopping_cart/orders_controller.rb', line 21
def destroy
@order.destroy
redirect_to root_path
end
|
#edit ⇒ Object
9
10
11
|
# File 'app/controllers/shopping_cart/orders_controller.rb', line 9
def edit
@order = OrderInProgress.new(current_user.id).query
end
|
#update ⇒ Object
13
14
15
16
17
18
19
|
# File 'app/controllers/shopping_cart/orders_controller.rb', line 13
def update
UpdateOrder.call(@order, params) do
on(:ok) { updated_notice('Order') }
on(:invalid) { update_error('Order') }
end
redirect_to root_path
end
|