Class: Cartify::OrderItemsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Cartify::OrderItemsController
- Defined in:
- app/controllers/cartify/order_items_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
5 6 7 8 9 |
# File 'app/controllers/cartify/order_items_controller.rb', line 5 def create current_order.save @order_item = current_order.order_items.find_or_initialize_by(product_id: order_item_params[:product_id]) session[:order_id] = current_order.id if update_quantity.save end |
#destroy ⇒ Object
17 18 19 20 21 |
# File 'app/controllers/cartify/order_items_controller.rb', line 17 def destroy @order_item = current_order.order_items.find(params[:id]) @order_item.destroy @order_items = current_order.order_items end |
#update ⇒ Object
11 12 13 14 15 |
# File 'app/controllers/cartify/order_items_controller.rb', line 11 def update @order_item = current_order.order_items.find(params[:id]) @order_item.update_attributes(order_item_params) @order_items = current_order.order_items end |