From 583b17c7eeed418c64865150beb3216389f5ccb8 Mon Sep 17 00:00:00 2001 From: Martin Meyerhoff Date: Tue, 19 Nov 2024 09:19:28 +0100 Subject: [PATCH] Add `#authorization_subject` to Promotions controllers The `authorization_subject` method from `solidus_admin` assumes that all models are in the `Spree` namespace. --- .../solidus_promotions/promotion_categories_controller.rb | 6 ++++++ .../admin/solidus_promotions/promotions_controller.rb | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/promotions/lib/controllers/admin/solidus_promotions/promotion_categories_controller.rb b/promotions/lib/controllers/admin/solidus_promotions/promotion_categories_controller.rb index cefb9d44d5d..0218e3a94c2 100644 --- a/promotions/lib/controllers/admin/solidus_promotions/promotion_categories_controller.rb +++ b/promotions/lib/controllers/admin/solidus_promotions/promotion_categories_controller.rb @@ -25,5 +25,11 @@ def destroy flash[:notice] = t(".success") redirect_back_or_to solidus_promotions.promotion_categories_path, status: :see_other end + + private + + def authorization_subject + SolidusPromotions::PromotionCategory + end end end diff --git a/promotions/lib/controllers/admin/solidus_promotions/promotions_controller.rb b/promotions/lib/controllers/admin/solidus_promotions/promotions_controller.rb index 77bc6515108..62b856006a0 100644 --- a/promotions/lib/controllers/admin/solidus_promotions/promotions_controller.rb +++ b/promotions/lib/controllers/admin/solidus_promotions/promotions_controller.rb @@ -42,5 +42,9 @@ def load_promotion def promotion_params params.require(:promotion).permit(:user_id, permitted_promotion_attributes) end + + def authorization_subject + SolidusPromotions::Promotion + end end end