Skip to content

Commit

Permalink
Do not constantize Spree.user_class in UserClassHandle
Browse files Browse the repository at this point in the history
`Spree.user_class` will constantize the configured user class. If called
during Rails start-up, this will autoload the configured user class,
which is not necessarily desired. We can do without the autoloading by
directly getting the class variable rather than going through
`Spree.user_class`.
  • Loading branch information
mamhoff committed Dec 4, 2024
1 parent f7a1391 commit 5f0056c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/lib/spree/user_class_handle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class UserClassHandle
# @return [String] the name of the user class as a string.
# @raise [RuntimeError] if Spree.user_class is nil
def to_s
fail "'Spree.user_class' has not been set yet." unless Spree.user_class
"::#{Spree.user_class}"
fail "'Spree.user_class' has not been set yet." unless Spree.class_variable_get?(:@@user_class)
"::#{Spree.class_variable_get(:@@user_class)}"
end
end
end

0 comments on commit 5f0056c

Please sign in to comment.