Class: LegoSpikeOrders::PurchaseOrdersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- LegoSpikeOrders::PurchaseOrdersController
- Defined in:
- app/controllers/lego_spike_orders/purchase_orders_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /purchase_orders.
-
#destroy ⇒ Object
DELETE /purchase_orders/1.
-
#edit ⇒ Object
GET /purchase_orders/1/edit.
-
#index ⇒ Object
GET /purchase_orders.
-
#new ⇒ Object
GET /purchase_orders/new.
-
#show ⇒ Object
GET /purchase_orders/1.
-
#update ⇒ Object
PATCH/PUT /purchase_orders/1.
Instance Method Details
#create ⇒ Object
POST /purchase_orders
24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/lego_spike_orders/purchase_orders_controller.rb', line 24 def create @purchase_order = PurchaseOrder.new(purchase_order_params) if @purchase_order.save redirect_to @purchase_order, notice: "Purchase order was successfully created." else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
DELETE /purchase_orders/1
44 45 46 47 |
# File 'app/controllers/lego_spike_orders/purchase_orders_controller.rb', line 44 def destroy @purchase_order.destroy! redirect_to purchase_orders_url, notice: "Purchase order was successfully destroyed.", status: :see_other end |
#edit ⇒ Object
GET /purchase_orders/1/edit
20 21 |
# File 'app/controllers/lego_spike_orders/purchase_orders_controller.rb', line 20 def edit end |
#index ⇒ Object
GET /purchase_orders
6 7 8 |
# File 'app/controllers/lego_spike_orders/purchase_orders_controller.rb', line 6 def index @purchase_orders = PurchaseOrder.all end |
#new ⇒ Object
GET /purchase_orders/new
15 16 17 |
# File 'app/controllers/lego_spike_orders/purchase_orders_controller.rb', line 15 def new @purchase_order = PurchaseOrder.new end |
#show ⇒ Object
GET /purchase_orders/1
11 12 |
# File 'app/controllers/lego_spike_orders/purchase_orders_controller.rb', line 11 def show end |
#update ⇒ Object
PATCH/PUT /purchase_orders/1
35 36 37 38 39 40 41 |
# File 'app/controllers/lego_spike_orders/purchase_orders_controller.rb', line 35 def update if @purchase_order.update(purchase_order_params) redirect_to @purchase_order, notice: "Purchase order was successfully updated.", status: :see_other else render :edit, status: :unprocessable_entity end end |