Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spree uninitialized constant Spree::UserSessionsController

Am having a problem with Spree where I'm getting Spree uninitialized constant Spree::UserSessionsController when I try to go to the /admin page. I am redirected to /login and it errors.

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'

I am using spree 2.2. Gemfile is

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'

I have double-checked spree.rb in the initializers folder. It has the standard Spree.user_class = "Spree::User"

All the routes and controllers I'm using are stock standard so not sure on what is causing this error. Any help would be greatly appreciated.

like image 403
davwood Avatar asked Feb 03 '26 05:02

davwood


2 Answers

did you try to switch the order of spree and spree_auth_devise devise in your Gemfile?

like image 166
Jason FB Avatar answered Feb 04 '26 17:02

Jason FB


Hey change sequence of spree gem in your Gemfile as follows.

Add spree gem top of other 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'
like image 25
Vishal Zambre Avatar answered Feb 04 '26 17:02

Vishal Zambre