From ef62fb885db855651f44797a9655e5dc63dd4368 Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 27 Jul 2023 16:35:43 +1000 Subject: [PATCH] Check if record actually saved I'm not sure if it will ever make a difference, but I think this makes more sense. --- app/controllers/voucher_adjustments_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/voucher_adjustments_controller.rb b/app/controllers/voucher_adjustments_controller.rb index 9b6a2bac26..329ca05712 100644 --- a/app/controllers/voucher_adjustments_controller.rb +++ b/app/controllers/voucher_adjustments_controller.rb @@ -38,7 +38,7 @@ class VoucherAdjustmentsController < BaseController adjustment = voucher.create_adjustment(voucher.code, @order) - unless adjustment.valid? + unless adjustment.persisted? @order.errors.add(:voucher_code, I18n.t('split_checkout.errors.add_voucher_error')) adjustment.errors.each { |error| @order.errors.import(error) } return false