Continue adding product variants

This commit is contained in:
2015-04-13 17:57:06 +02:00
parent 6746eaa383
commit 2b036368cf
32 changed files with 169 additions and 12224 deletions
@@ -24,6 +24,13 @@ module Suppliers
# POST /product_variants
# POST /product_variants.json
def create
@product_variant = ProductVariant.new(product_variant_params)
@product_variant.supplier = current_supplier
if @product_variant.save
render json: @product_variant
else
render json: {errors: @product_variant.errors}, status: :unprocessable_entity
end
end
# PUT /product_variants/1
@@ -44,13 +51,10 @@ module Suppliers
# DELETE /product_variants/1
# DELETE /product_variants/1.json
def destroy
@product_variant = ProductVariant.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
#@product_variant = ProductVariant.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
@product_variant = ProductVariant.find(params[:id])
@product_variant.destroy
respond_to do |format|
format.html { redirect_to suppliers_product_variants_url, notice: t('action.destroy.successfull', model: ProductVariant.model_name.human) }
format.json { head :no_content }
end
render json: {}
end
private