Class: Workarea::Api::Admin::LegacyOrdersController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/workarea/api/admin/legacy_orders_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
# File 'app/controllers/workarea/api/admin/legacy_orders_controller.rb', line 15

def create
  @order = LegacyOrder.create!(params[:order])
  respond_with(
    { order: @order },
    status: :created,
    location: legacy_order_path(@order.id)
  )
end

#indexObject



6
7
8
9
10
11
12
13
# File 'app/controllers/workarea/api/admin/legacy_orders_controller.rb', line 6

def index
  @orders = LegacyOrder
    .all
    .order_by(sort_field => sort_direction)
    .page(params[:page])

  respond_with orders: @orders
end

#showObject



24
25
26
27
# File 'app/controllers/workarea/api/admin/legacy_orders_controller.rb', line 24

def show
  @order = LegacyOrder.find(params[:id])
  respond_with order: @order
end

#updateObject



29
30
31
32
33
# File 'app/controllers/workarea/api/admin/legacy_orders_controller.rb', line 29

def update
  @order = LegacyOrder.find(params[:id])
  @order.update_attributes!(params[:order])
  respond_with order: @order
end