我遇到了Spree的问题,当我试图转到/admin页面时,我得到了Spree未初始化的常量Spree::UserSessionsController。我被重定向到/login和它的错误。
Started GET "/admin" for 127.0.0.1 at 2014-07-22 20:26:22 +1000
Processing by Spree::Admin::OrdersController#index as HTML
Spree::Preference Load (2.4ms) SELECT "spree_preferences".* FROM "spree_preferences" WHERE "spree_preferences"."key" = 'spree/backend_configuration/locale' LIMIT 1
Redirected to http://localhost:3000/login
Completed 302 Found in 499ms (ActiveRecord: 14.4ms)
Started GET "/login" for 127.0.0.1 at 2014-07-22 20:26:22 +1000
ActionController::RoutingError - uninitialized constant Spree::UserSessionsController:
actionpack (4.0.3) lib/action_dispatch/routing/route_set.rb:69:in `rescue in controller'
actionpack (4.0.3) lib/action_dispatch/routing/route_set.rb:64:in `controller'
我使用的是spree 2.2。Gemfile是
gem 'rails', '4.0.3'
gem 'pg'
gem 'sass-rails', '~> 4.0.2'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'unicorn'
gem 'spree_gateway', :git => 'https://github.com/spree/spree_gateway.git', :branch => '2-2-stable'
gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-2-stable'
gem 'spree', '2.2.0'
gem 'spree_bootstrap_frontend', github: '200Creative/spree_bootstrap_frontend', branch: '2-2-stable'
gem 'spree_blogging_spree', github: 'stefansenk/spree-blogging-spree', :branch => '2-2-stable'
gem 'spree_editor', github: 'spree/spree_editor', :branch => '2-2-stable'
gem 'spree_print_invoice' , :git => 'git://github.com/spree/spree_print_invoice.git', :branch => '2-2-stable'
我仔细检查了initializers文件夹中的spree.rb。它有标准的Spree.user_class = "Spree::User"
我使用的所有路由和控制器都是标准的,所以不确定是什么导致了这个错误。任何帮助都将不胜感激。
发布于 2015-03-21 01:13:01
你有没有试着在你的Gemfile中调换spree和spree_auth_devise设备的顺序?
发布于 2016-07-01 19:26:45
嘿,在你的Gemfile中改变spree gem的顺序如下。
将spree gem添加到其他spree gem顶部
gem 'spree', '2.2.0'
gem 'spree_gateway', :git => 'https://github.com/spree/spree_gateway.git', :branch => '2-2-stable'
gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-2-stable'
gem 'spree_bootstrap_frontend', github: '200Creative/spree_bootstrap_frontend', branch: '2-2-stable'
gem 'spree_blogging_spree', github: 'stefansenk/spree-blogging-spree', :branch => '2-2-stable'
gem 'spree_editor', github: 'spree/spree_editor', :branch => '2-2-stable'
gem 'spree_print_invoice' , :git => 'git://github.com/spree/spree_print_invoice.git', :branch => '2-2-stable'
https://stackoverflow.com/questions/24885793
复制相似问题