From 496d2a513a547d6fd14839a271bc402876444048 Mon Sep 17 00:00:00 2001 From: Jared Norman Date: Wed, 2 Sep 2026 19:59:13 -0700 Subject: [PATCH] Use bare config accessors Replace Spree::Config[:foo] with the bare accessors. Both dispatch to the same preferred_foo body; the bare form skips has_preference!'s array scan and matches the form used by Solidus core and most of this codebase. A store that overrides preferred_foo on a configuration class no longer affects these reads. Nothing in this workspace does that. --- README.md | 2 +- app/controllers/spree/admin/installments_controller.rb | 2 +- app/controllers/spree/admin/subscriptions_controller.rb | 2 +- app/models/solidus_subscriptions/subscription.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 815c5ec5..71264b5e 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ An example would be adding this to the registration page: ```erb <%# spree/checkout/registration.html.erb %> -<% if Spree::Config[:allow_guest_checkout] && current_order.subscription_line_items.empty? %> +<% if Spree::Config.allow_guest_checkout && current_order.subscription_line_items.empty? %> ``` This allows guests to add subscriptions to their carts as guests, but forces them to login or create diff --git a/app/controllers/spree/admin/installments_controller.rb b/app/controllers/spree/admin/installments_controller.rb index 296f80b2..8f71835c 100644 --- a/app/controllers/spree/admin/installments_controller.rb +++ b/app/controllers/spree/admin/installments_controller.rb @@ -12,7 +12,7 @@ def index @installments = @search.result(distinct: true) .page(params[:page]) - .per(params[:per_page] || Spree::Config[:orders_per_page]) + .per(params[:per_page] || Spree::Config.orders_per_page) end private diff --git a/app/controllers/spree/admin/subscriptions_controller.rb b/app/controllers/spree/admin/subscriptions_controller.rb index 74be671d..de1257ec 100644 --- a/app/controllers/spree/admin/subscriptions_controller.rb +++ b/app/controllers/spree/admin/subscriptions_controller.rb @@ -10,7 +10,7 @@ def index @subscriptions = @search.result(distinct: true) .includes(:line_items, :user) .page(params[:page]) - .per(params[:per_page] || Spree::Config[:orders_per_page]) + .per(params[:per_page] || Spree::Config.orders_per_page) end def new diff --git a/app/models/solidus_subscriptions/subscription.rb b/app/models/solidus_subscriptions/subscription.rb index 20e46658..e8903ceb 100644 --- a/app/models/solidus_subscriptions/subscription.rb +++ b/app/models/solidus_subscriptions/subscription.rb @@ -386,7 +386,7 @@ def set_payment_method end def set_currency - self.currency ||= ::Spree::Config[:currency] + self.currency ||= ::Spree::Config.currency end def generate_guest_token