我一直在試圖設置狂熱和煉油廠以下目的: 使用相同的認證系統爲。「未初始化的恆定用戶」當設置狂歡和煉油廠時
根據一個github上的項目和後續的拉進大禮包主分支......這應該順利(在第一個答案的評論可用鏈路)
我給了一個艱難的嘗試,但我無法擺脫的「未初始化的常量用戶「錯誤。我將嘗試描述能夠複製錯誤的所有必要步驟。
Firstofall,該環境在:
gem install rails
rails new spreefinery
cd spreefinery
# resolve a dependency on which bundler fails
sed "s/'jquery-rails'/'jquery-rails', '~>2.0.0'/g" -i Gemfile
echo "# adding custom gems for both spree and refinery
gem 'spree', :git => 'git://github.com/spree/spree.git', :branch => '1-2-stable'
gem 'spree_usa_epay'
gem 'spree_skrill'
gem 'refinerycms', :git => 'git://github.com/refinery/refinerycms.git', :branch => '2-0-stable'" >> Gemfile
bundle install
其次,作爲與補丁在guide
rails generate refinery:cms --fresh-installation
指示用於分頁
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" > config/initializers/spreefinery.rb
最終安裝煉油廠,安裝禮包(無認證)
個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]
這最後一個命令運行爲:
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 => db:abort_if_pending_migrations => 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 => '/'
**************************************************
Spree has been installed successfully. You're all ready to go!
Enjoy!
你可以看到在DB的錯誤:種子一步。
同樣的錯誤再次出現在rails server或rake db上:migrate。這裏是完整的回溯:
rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
uninitialized constant User
/Users/emb/.rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:230:in `block in constantize'
/Users/emb/.rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in `each'
/Users/emb/.rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in `constantize'
/Users/emb/.rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
/Users/emb/.rvm/gems/[email protected]/bundler/gems/spree-dbb0c56a60a9/core/lib/spree/core.rb:52:in `user_class'
/Users/emb/.rvm/gems/[email protected]/bundler/gems/spree-dbb0c56a60a9/promo/app/models/spree/promotion/rules/user.rb:7:in `<class:User>'
/Users/emb/.rvm/gems/[email protected]/bundler/gems/spree-dbb0c56a60a9/promo/app/models/spree/promotion/rules/user.rb:4:in `<module:Rules>'
/Users/emb/.rvm/gems/[email protected]/bundler/gems/spree-dbb0c56a60a9/promo/app/models/spree/promotion/rules/user.rb:3:in `<class:Promotion>'
/Users/emb/.rvm/gems/[email protected]/bundler/gems/spree-dbb0c56a60a9/promo/app/models/spree/promotion/rules/user.rb:2:in `<module:Spree>'
/Users/emb/.rvm/gems/[email protected]/bundler/gems/spree-dbb0c56a60a9/promo/app/models/spree/promotion/rules/user.rb:1:in `<top (required)>'
/Users/emb/.rvm/gems/[email protected]/bundler/gems/spree-dbb0c56a60a9/promo/lib/spree/promo/engine.rb:44:in `block in <class:Engine>'
/Users/emb/.rvm/gems/[email protected]finery/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
/Users/emb/.rvm/gems/[email protected]/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
/Users/emb/.rvm/gems/[email protected]/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/emb/.rvm/gems/[email protected]/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
/Users/emb/.rvm/gems/[email protected]/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
/Users/emb/.rvm/gems/[email protected]/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
/Users/emb/.rvm/gems/[email protected]/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/emb/Documents/envs/spreefinery/config/environment.rb:5:in `<top (required)>'
/Users/emb/.rvm/gems/[email protected]/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
/Users/emb/.rvm/gems/[email protected]/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require'
/Users/emb/.rvm/gems/[email protected]/gems/railties-3.2.8/lib/rails/application.rb:103:in `require_environment!'
/Users/emb/.rvm/gems/[email protected]/gems/railties-3.2.8/lib/rails/application.rb:295:in `block (2 levels) in initialize_tasks'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/emb/.rvm/gems/[email protected]/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/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/Users/emb/.rvm/gems/[email protected]/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/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/emb/.rvm/gems/[email protected]/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/emb/.rvm/gems/[email protected]/bin/rake:19:in `load'
/Users/emb/.rvm/gems/[email protected]/bin/rake:19:in `<main>'
/Users/emb/.rvm/gems/ruby-1.9.3-p[email protected]/bin/ruby_noexec_wrapper:14:in `eval'
/Users/emb/.rvm/gems/[email protected]/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:migrate => environment
我需要一些幫助在這一點上。我發現了一些關於這個錯誤的帖子,說明的模型用戶可能不存在......但煉油廠明確宣佈User class ......所以我有點困惑。
感謝您的幫助! Manu
是它正常工作與兩個認證系統,但它不是很方便,有獨立的2用戶管理在一個網站:)我認爲大禮包將使用煉油廠系統我做過的方式......它看起來很像[pibiboily](https://github.com/jipiboily/spree_refinery_auth),它已被[集成](https://github.com/spree/spree/)閱讀了github上的工作拉/ 1512)變成狂歡(並導致選項「無身份驗證」) – Manu