【问题标题】:Spree uninitialized constant Spree::UserSessionsControllerSpree 未初始化常量 Spree::UserSessionsController
【发布时间】:2014-07-22 11:11:44
【问题描述】:

我在尝试访问 /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'

我在初始化文件夹中仔细检查了 spree.rb。 它有标准的Spree.user_class = "Spree::User"

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

【问题讨论】:

    标签: ruby-on-rails spree


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      你在 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'
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-08-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多