mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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) }
|
||||
Reference in New Issue
Block a user