Skip to content

Commit

Permalink
Use user_class#name
Browse files Browse the repository at this point in the history
Alchemy 4.4.2 has a fix for constant lookup issues
(AlchemyCMS/alchemy_cms#1724)

That prefixes the user class with `::`

In order to be compatible with older Alchemy versions we use
the class#name instead.
  • Loading branch information
tvdeyen committed Feb 25, 2020
1 parent 85fd579 commit 7a1dc15
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/alchemy/solidus/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down

0 comments on commit 7a1dc15

Please sign in to comment.