Skip to content

Commit

Permalink
Force Spree.user_class to be set to Spree::User to fix the infamous e…
Browse files Browse the repository at this point in the history
…rror:

rake aborted!
Association named 'spree_roles' was not found; perhaps you misspelled it?

It's tripped me up WAY too many times now.
  • Loading branch information
radar committed Jun 27, 2013
1 parent ef155ae commit ff68f6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/initializers/spree.rb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Spree.user_class = "Spree::User"

4 changes: 4 additions & 0 deletions lib/spree/auth/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def self.activate
ApplicationController.send :include, Spree::AuthenticationHelpers
end

initializer "spree_auth_devise.set_user_class", :after => :load_config_initializers do
Spree.user_class = "Spree::User"
end

config.to_prepare &method(:activate).to_proc
end
end
Expand Down

0 comments on commit ff68f6c

Please sign in to comment.