Class: Workarea::Api::Admin::ProductImagesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/workarea/api/admin/product_images_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/product_images_controller.rb', line 93

def create
  @image = @product.images.create!(params[:image])
  respond_with(
    { image: @image },
    { status: :created,
    location: product_images_path(@product.id) }
  )
end

#destroyObject



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

def destroy
  @image.destroy
  head :no_content
end

#indexObject



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

def index
  respond_with images: @product.images
end

#updateObject



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

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