Class: Workarea::Api::Admin::PricesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/workarea/api/admin/prices_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user, #sort_direction, #sort_field

Instance Method Details

#createObject



93
94
95
96
97
98
99
100
# File 'app/controllers/workarea/api/admin/prices_controller.rb', line 93

def create
  @price = @sku.prices.create!(params[:price])
  respond_with(
    { price: @price },
    { status: :created,
    location: pricing_sku_prices_path(@sku) }
  )
end

#destroyObject



215
216
217
218
# File 'app/controllers/workarea/api/admin/prices_controller.rb', line 215

def destroy
  @price.destroy
  head :no_content
end

#indexObject



89
90
91
# File 'app/controllers/workarea/api/admin/prices_controller.rb', line 89

def index
  respond_with prices: @sku.prices
end

#updateObject



210
211
212
213
# File 'app/controllers/workarea/api/admin/prices_controller.rb', line 210

def update
  @price.update_attributes!(params[:price])
  respond_with price: @price
end