title: "uninitialized constant User" when setting up spree and refinery together
body: <p>I have been trying to set up spree and refinery together with the following purpose :
  <strong>using same authentification system for both</strong>.</p>
  
  <p>According a github project and a subsequent pull into spree master branch... this should go smoothly (links available in comment of first answer)</p>
  
  <p>I gave a hard try but I can't get rid of "uninitialized constant User" error. I will try to describe all the necessary steps to be able to replicate the error.</p>
  
  <p>Firstofall, the environnement :</p>
  
  <pre><code>gem install rails
  rails new spreefinery
  cd spreefinery
  
  # resolve a dependency on which bundler fails
  sed "s/'jquery-rails'/'jquery-rails', '~&gt;2.0.0'/g" -i Gemfile 
  
  echo "# adding custom gems for both spree and refinery
  gem 'spree', :git =&gt; 'git://github.com/spree/spree.git', :branch =&gt; '1-2-stable'
  gem 'spree_usa_epay'
  gem 'spree_skrill'
  gem 'refinerycms', :git =&gt; 'git://github.com/refinery/refinerycms.git', :branch =&gt; '2-0-stable'" &gt;&gt; Gemfile
  
  bundle install
  </code></pre>
  
  <p>Secondly, install refinery as indicated in the <a href="http://refinerycms.com/guides/with-an-existing-rails-app" rel="nofollow">guide</a></p>
  
  <pre><code>rails generate refinery:cms --fresh-installation
  </code></pre>
  
  <p>with a patch for pagination</p>
  
  <pre><code>echo "#Refinery uses the will_paginate gem for pagination, 
  # while Spree uses Kaminari.... This fix makes both happy
  
  if defined?(WillPaginate)
    module WillPaginate
      module ActiveRecord
        module RelationMethods
          alias_method :per, :per_page
          alias_method :num_pages, :total_pages
        end
      end 
    end
  end" &gt; config/initializers/spreefinery.rb
  </code></pre>
  
  <p>Eventually, install spree (without authentification)</p>
  
  <pre><code>bundle exec spree install --git=git://github.com/spree/spree.git --branch=1-2-stable
  
  # use default config except for authentification :
    Would you like to install the default gateways? (yes/no) [yes] 
    Would you like to install the default authentication system? (yes/no) [yes] no
    What is the name of the class representing users within your application? [User] 
    Would you like to run the migrations? (yes/no) [yes] 
    Would you like to load the seed data? (yes/no) [yes] 
    Would you like to load the sample data? (yes/no) [yes] 
  </code></pre>
  
  <p>This last command runs as :</p>
  
  <pre><code> gemfile  spree
   gemfile  spree_usa_epay
   gemfile  spree_skrill
       run  bundle install from "."
    create  config/initializers/spree.rb
    create  config/spree.yml
    remove  public/index.html
    append  public/robots.txt
    create  app/assets/javascripts/store
    create  app/assets/javascripts/admin
    create  app/assets/stylesheets/store
    create  app/assets/stylesheets/admin
    create  app/assets/images/store
    create  app/assets/images/admin
    create  app/assets/javascripts/store/all.js
    create  app/assets/javascripts/admin/all.js
    create  app/assets/stylesheets/store/all.css
    create  app/assets/stylesheets/admin/all.css
    create  app/overrides
    append  config/environment.rb
    append  db/seeds.rb
   copying  migrations
  creating  database
   running  migrations
   loading  seed data
      rake  db:seed 
  rake aborted!
  uninitialized constant User
  
  Tasks: TOP =&gt; db:abort_if_pending_migrations =&gt; environment
  (See full trace by running task with --trace)
       loading  sample data
        insert  config/routes.rb
  **************************************************
  We added the following line to your application's config/routes.rb file:
  
  mount Spree::Core::Engine, :at =&gt; '/'
  **************************************************
  Spree has been installed successfully. You're all ready to go!
  
  Enjoy!
  </code></pre>
  
  <p>You can see the error on db:seed step.</p>
  
  <p>The same error comes again on rails server or rake db:migrate. Here is the full traceback:</p>
  
  <pre><code>rake db:migrate --trace
  ** Invoke db:migrate (first_time)
  ** Invoke environment (first_time)
  ** Execute environment
  rake aborted!
  uninitialized constant User
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:230:in `block in constantize'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in `each'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in `constantize'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/gems/activesupport-3.2.8/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/bundler/gems/spree-dbb0c56a60a9/core/lib/spree/core.rb:52:in `user_class'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/bundler/gems/spree-dbb0c56a60a9/promo/app/models/spree/promotion/rules/user.rb:7:in `&lt;class:User&gt;'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/bundler/gems/spree-dbb0c56a60a9/promo/app/models/spree/promotion/rules/user.rb:4:in `&lt;module:Rules&gt;'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/bundler/gems/spree-dbb0c56a60a9/promo/app/models/spree/promotion/rules/user.rb:3:in `&lt;class:Promotion&gt;'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/bundler/gems/spree-dbb0c56a60a9/promo/app/models/spree/promotion/rules/user.rb:2:in `&lt;module:Spree&gt;'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/bundler/gems/spree-dbb0c56a60a9/promo/app/models/spree/promotion/rules/user.rb:1:in `&lt;top (required)&gt;'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/bundler/gems/spree-dbb0c56a60a9/promo/lib/spree/promo/engine.rb:44:in `block in &lt;class:Engine&gt;'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
  /Users/emb/Documents/envs/spreefinery/config/environment.rb:5:in `&lt;top (required)&gt;'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/gems/railties-3.2.8/lib/rails/application.rb:103:in `require_environment!'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/gems/railties-3.2.8/lib/rails/application.rb:295:in `block (2 levels) in initialize_tasks'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
  /Users/emb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
  /Users/emb/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/bin/rake:33:in `&lt;top (required)&gt;'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/bin/rake:19:in `load'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@global/bin/rake:19:in `&lt;main&gt;'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/bin/ruby_noexec_wrapper:14:in `eval'
  /Users/emb/.rvm/gems/ruby-1.9.3-p194@spreefinery/bin/ruby_noexec_wrapper:14:in `&lt;main&gt;'
  Tasks: TOP =&gt; db:migrate =&gt; environment
  </code></pre>
  
  <p>I would need some help at this point. I have found some posts about this error stating than the model User might not exist... but refinery definitively declares a <a href="https://github.com/refinery/refinerycms/blob/master/authentication/app/models/refinery/user.rb" rel="nofollow">User class</a>... so I am a bit confused.</p>
  
  <p>Thanks for your help !
  Manu</p>