diff --git a/promotions/lib/controllers/backend/solidus_promotions/admin/benefits_controller.rb b/promotions/lib/controllers/backend/solidus_promotions/admin/benefits_controller.rb index cd0f40da056..354a37ac8ba 100644 --- a/promotions/lib/controllers/backend/solidus_promotions/admin/benefits_controller.rb +++ b/promotions/lib/controllers/backend/solidus_promotions/admin/benefits_controller.rb @@ -14,12 +14,12 @@ def new def create @benefit = @benefit_type.new(benefit_params) @benefit.promotion = @promotion - if @benefit.save(validate: false) + if @benefit.save flash[:success] = t("spree.successfully_created", resource: SolidusPromotions::Benefit.model_name.human) redirect_to location_after_save, format: :html else - render :new, layout: false + render :new, layout: false, status: :unprocessable_entity end end @@ -28,7 +28,7 @@ def edit if params.dig(:benefit, :calculator_type) @benefit.calculator_type = params[:benefit][:calculator_type] end - render layout: false + render layout: false, status: :unprocessable_entity end def update @@ -39,7 +39,7 @@ def update t("spree.successfully_updated", resource: SolidusPromotions::Benefit.model_name.human) redirect_to location_after_save, format: :html else - render :edit + render :edit, status: :unprocessable_entity end end