狂欢未初始化的常量Spree :: UserSessionsController

时间:2014-07-22 11:11:45

标签: ruby-on-rails spree

我遇到了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'

我正在使用狂欢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"

我使用的所有路线和控制器都是库存标准,因此不确定导致此错误的原因。任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:5)

您是否尝试在Gemfile中切换spree和spree_auth_devise设计的顺序?

答案 1 :(得分:1)

嘿,你可以在Gemfile中更改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'