From 58b43c7bc936e8477d10ae1c216cf1c5c467f2fc Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Wed, 24 Jul 2019 09:23:51 +0100 Subject: [PATCH] Remove update_product_image.v1.rabl and switch controller from respond_with to render json to switch from rabl to AMS --- app/controllers/api/product_images_controller.rb | 4 ++-- app/views/api/product_images/update_product_image.v1.rabl | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 app/views/api/product_images/update_product_image.v1.rabl diff --git a/app/controllers/api/product_images_controller.rb b/app/controllers/api/product_images_controller.rb index adcf978c51..71fc9a5164 100644 --- a/app/controllers/api/product_images_controller.rb +++ b/app/controllers/api/product_images_controller.rb @@ -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 diff --git a/app/views/api/product_images/update_product_image.v1.rabl b/app/views/api/product_images/update_product_image.v1.rabl deleted file mode 100644 index c9e62475dc..0000000000 --- a/app/views/api/product_images/update_product_image.v1.rabl +++ /dev/null @@ -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) }