Sha256: ddffc1b0b82531c75b5ee98080ef33a7e6d770e9d1e32944296197c023375f61
Contents?: true
Size: 837 Bytes
Versions: 3
Compression:
Stored size: 837 Bytes
Contents
require_dependency "shopping_cart/application_controller" module ShoppingCart class OrdersController < ApplicationController include ShoppingCart::StandardFlashes before_action :set_order, only: [:update, :destroy] def edit @order = OrderInProgress.new(current_user.id).query end def update UpdateOrder.call(@order, params) do on(:ok) { updated_notice('Order') } on(:invalid) { update_error('Order') } end redirect_to root_path end def destroy @order.destroy redirect_to root_path end def create CreateOrder.call(params) do on(:ok) { redirect_to root_path } on(:invalid) { create_order_failed } end end private def set_order @order = Order.find_by_id params[:id] end end end
Version data entries
3 entries across 3 versions & 1 rubygems