From 7a1dc1591272c243d82a11f37391c2400b297da1 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Tue, 25 Feb 2020 14:08:48 +0100 Subject: [PATCH 1/2] Use user_class#name Alchemy 4.4.2 has a fix for constant lookup issues (https://github.com/AlchemyCMS/alchemy_cms/pull/1724/) That prefixes the user class with `::` In order to be compatible with older Alchemy versions we use the class#name instead. --- lib/alchemy/solidus/engine.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/alchemy/solidus/engine.rb b/lib/alchemy/solidus/engine.rb index 6dd9b51..062c289 100644 --- a/lib/alchemy/solidus/engine.rb +++ b/lib/alchemy/solidus/engine.rb @@ -12,12 +12,12 @@ class Engine < ::Rails::Engine Alchemy.register_ability ::Spree::Ability ::Spree::Ability.register_ability ::Alchemy::Permissions - if Alchemy.user_class_name == 'Spree::User' + if Alchemy.user_class.name == 'Spree::User' require 'alchemy/solidus/spree_user_extension' Spree::User.include Alchemy::Solidus::SpreeUserExtension end - if Alchemy.user_class_name == 'Alchemy::User' + if Alchemy.user_class.name == 'Alchemy::User' require 'alchemy/solidus/alchemy_user_extension' Alchemy::User.include Alchemy::Solidus::AlchemyUserExtension require 'alchemy/solidus/spree_admin_unauthorized_redirect' @@ -40,7 +40,7 @@ class Engine < ::Rails::Engine # Fix for +belongs_to :bill_address+ in {Spree::UserAddressBook} # Solidus has this set to +false+ in {Spree::Base}, but {Alchemy::User} does not inherit from it. initializer 'alchemy_solidus.belongs_bill_address_fix' do - if Alchemy.user_class_name == 'Alchemy::User' + if Alchemy.user_class.name == 'Alchemy::User' ActiveSupport.on_load(:active_record) do Alchemy::User.belongs_to_required_by_default = false end From 60d1786fd1c5f7b5a00013976332f22ad4b163d5 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Tue, 25 Feb 2020 15:18:41 +0100 Subject: [PATCH 2/2] Use configured Alchemy.login_path Fix for latest alchemy-devise master that moves the admin login into admin namespace. Since Alchemy.login is always configured correctly we can use this instead. --- lib/alchemy/solidus/spree_admin_unauthorized_redirect.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/alchemy/solidus/spree_admin_unauthorized_redirect.rb b/lib/alchemy/solidus/spree_admin_unauthorized_redirect.rb index 6679543..a8307b1 100644 --- a/lib/alchemy/solidus/spree_admin_unauthorized_redirect.rb +++ b/lib/alchemy/solidus/spree_admin_unauthorized_redirect.rb @@ -4,6 +4,6 @@ redirect_to spree.root_path else store_location - redirect_to alchemy.login_path + redirect_to Alchemy.login_path end end