Skip to content

Commit

Permalink
Default Spree.user_class to "LegacyUser"
Browse files Browse the repository at this point in the history
Don't require it to be set in the initializer anymore.

It's rather common that a store has the initializer still setting the
user_class to "LegacyUser" and the devise initializer re-sets it to
"Spree::User".
  • Loading branch information
elia committed Sep 26, 2022
1 parent 44c51fa commit 9e45241
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ Spree::Api::Config.configure do |config|
end
<% end -%>

Spree.user_class = <%= (options[:user_class].blank? ? "Spree::LegacyUser" : options[:user_class]).inspect %>
<% if options[:user_class].present? -%>
Spree.user_class = <%= options[:user_class].inspect %>
<% end -%>

# Rules for avoiding to store the current path into session for redirects
# When at least one rule is matched, the request path will not be stored
Expand Down
2 changes: 1 addition & 1 deletion core/lib/spree/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
StateMachines::Machine.ignore_method_conflicts = true

module Spree
mattr_accessor :user_class
mattr_accessor :user_class, default: 'Spree::LegacyUser'

def self.user_class
if @@user_class.is_a?(Class)
Expand Down

0 comments on commit 9e45241

Please sign in to comment.