首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Spree未初始化常量Spree::UserSessionsController

Spree未初始化常量Spree::UserSessionsController
EN

Stack Overflow用户
提问于 2014-07-22 19:11:45
回答 2查看 1.7K关注 0票数 2

我遇到了Spree的问题,当我试图转到/admin页面时,我得到了Spree未初始化的常量Spree::UserSessionsController。我被重定向到/login和它的错误。

代码语言:javascript
运行
复制
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是

代码语言:javascript
运行
复制
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"

我使用的所有路由和控制器都是标准的,所以不确定是什么导致了这个错误。任何帮助都将不胜感激。

EN

回答 2

Stack Overflow用户

发布于 2015-03-21 01:13:01

你有没有试着在你的Gemfile中调换spree和spree_auth_devise设备的顺序?

票数 7
EN

Stack Overflow用户

发布于 2016-07-01 19:26:45

嘿,在你的Gemfile中改变spree gem的顺序如下。

将spree gem添加到其他spree gem顶部

代码语言:javascript
运行
复制
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'
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24885793

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档