Howto extend the Spree::User class from the Rails app that uses the solidus gem
<p>I'd like to add a <code>vendor?</code> function to Spree::User.
So I created <strong>app/models/spree/user.rb</strong></p>

<pre><code>module Spree
  class User &lt; Spree::Base

    include Spree::UserMethods

    def vendor?
      self.role_users.any? { |ru| ru.role.name == 'vendor' }
    end

  end
end
</code></pre>

<p>This works if I start rails console and test:
<code>u = Spree::User.last; u.vendor? # =&gt; false</code></p>

<p>But when I start rails server and visit a page I get this error:
NoMethodError in Spree::Admin::OrdersController#index
undefined method `serialize_from_session' for #</p>

<p><strong>Stack trace</strong></p>

<pre><code>activerecord (4.2.5) lib/active_record/dynamic_matchers.rb:26:in `method_missing'
devise (3.5.4) lib/devise.rb:465:in `block (2 levels) in configure_warden!'
warden (1.2.4) lib/warden/session_serializer.rb:34:in `fetch'
warden (1.2.4) lib/warden/proxy.rb:212:in `user'
warden (1.2.4) lib/warden/proxy.rb:322:in `_perform_authentication'
warden (1.2.4) lib/warden/proxy.rb:104:in `authenticate'
devise (3.5.4) lib/devise/controllers/helpers.rb:124:in `current_spree_user'
solidus_auth_devise (1.3.0) lib/spree/authentication_helpers.rb:11:in `spree_current_user'
solidus/core/lib/spree/core/controller_helpers/auth.rb:67:in `try_spree_current_user'
solidus/core/lib/spree/core/controller_helpers/auth.rb:31:in `current_ability'
cancancan (1.13.1) lib/cancan/controller_additions.rb:338:in `authorize!'
solidus/backend/app/controllers/spree/admin/base_controller.rb:22:in `authorize_admin'
</code></pre>

<p>Any idea what I should do to fix this error? According to the stack trace it looks like I'm missing a method somewhere.</p>

<p>Cheers,
Martin</p>