Remove update_product_image.v1.rabl and switch controller from respond_with to render json to switch from rabl to AMS

This commit is contained in:
luisramos0
2019-07-24 09:23:51 +01:00
parent 35841066d1
commit 58b43c7bc9
2 changed files with 2 additions and 7 deletions

View File

@@ -8,11 +8,11 @@ module Api
if @product.images.first.nil?
@image = Spree::Image.create(attachment: params[:file], viewable_id: @product.master.id, viewable_type: 'Spree::Variant')
respond_with(@image, status: 201)
render json: @image, serializer: ImageSerializer, status: :created
else
@image = @product.images.first
@image.update_attributes(attachment: params[:file])
respond_with(@image, status: 200)
render json: @image, serializer: ImageSerializer, status: :ok
end
end
end

View File

@@ -1,5 +0,0 @@
object @image
attributes(*image_attributes)
attributes :viewable_type, :viewable_id
node( :thumb_url ) { @product.images.first.attachment.url(:mini) }
node( :image_url ) { @product.images.first.attachment.url(:product) }