From d62cc83b7527d5df7405d3dd898e252133aabae0 Mon Sep 17 00:00:00 2001 From: Martin Meyerhoff Date: Tue, 3 Dec 2024 10:08:18 +0100 Subject: [PATCH] Fix(promotions): Add model_class method to PromotionCodesController Because the new promotion system lives outside the `spree` namespace, we need to be diligent about adding `model_class` to all the controllers. I have not added a spec, because this only fails if solidus_legacy_promotions is not loaded, and that is not the case in our test suite. --- .../solidus_promotions/admin/promotion_codes_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/promotions/lib/controllers/backend/solidus_promotions/admin/promotion_codes_controller.rb b/promotions/lib/controllers/backend/solidus_promotions/admin/promotion_codes_controller.rb index ee23a457469..ea7e9ba5a4d 100644 --- a/promotions/lib/controllers/backend/solidus_promotions/admin/promotion_codes_controller.rb +++ b/promotions/lib/controllers/backend/solidus_promotions/admin/promotion_codes_controller.rb @@ -53,6 +53,10 @@ def load_promotion .accessible_by(current_ability, :show) .find(params[:promotion_id]) end + + def model_class + SolidusPromotions::PromotionCode + end end end end