0

运行时出现Uninitialized constant Devise错误rake db:migrate

在 Gemfile 中:gem 'devise'带有成功的bundle install.

我尝试将 'require "devise"' 添加到 config/application.rb 但没有成功。在 config/application.rb 中:

if defined?(Bundler)  
  Bundler.require(*Rails.groups(:assets => %w(development test)))  
end

堆栈跟踪:

uninitialized constant Devise
/Users/cs/.Trash/qa/config/initializers/devise.rb:3:in `<top (required)>'
/Users/cs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.9/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
/Users/cs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.9/lib/rails/engine.rb:587:in `each'
/Users/cs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.9/lib/rails/engine.rb:587:in `block in <class:Engine>'
/Users/cs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `instance_exec'
/Users/cs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `run'
/Users/cs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.9/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/cs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `each'
/Users/cs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `run_initializers'
/Users/cs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.9/lib/rails/application.rb:136:in `initialize!'
/Users/cs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.9/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/cs/.Trash/qa/config/environment.rb:5:in `<top (required)>'
/Users/cs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.9/lib/rails/application.rb:103:in `require_environment!'
/Users/cs/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.9/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
Tasks: TOP => routes => environment
(See full trace by running task with --trace)

宝石文件:

source 'https://rubygems.org'

gem 'rails', '3.2.9'

## JRUBY GEMS
gem 'activerecord-jdbc-adapter'
gem 'activerecord-jdbcpostgresql-adapter'
gem 'jdbc-postgres'
gem 'jruby-openssl'

## FRONT END/DESIGN GEMS
gem 'jquery-rails'
gem 'bootstrap-sass'
gem 'haml'
gem 'font-awesome-sass-rails'

## ADMINISTRATION
gem 'activeadmin'
gem 'rufus-scheduler'

## AUTHENTICATION
gem 'bcrypt-ruby'
gem 'devise'

## FILE UPLOADS
gem 'paperclip'
gem 'aws-sdk'

## PERFORMANCE
gem 'dalli'
gem "trinidad"

## TESTING
gem "seedbank"

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'therubyrhino'
  gem 'uglifier', '>= 1.0.3'
  gem 'closure-compiler'
end
4

1 回答 1

0

有点晚了,但我遇到了同样的问题。清理垃圾并重新启动外壳应该是解决方案。

当您将一些文件夹移动到垃圾箱时,终端中存在一个错误,然后引用错误。

于 2015-05-07T07:02:42.050 回答