未初始化的常量设计

时间:2012-12-11 19:16:04

标签: ruby-on-rails ruby-on-rails-3 devise

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

在Gemfile中:gem 'devise'成功bundle install

我尝试将'require'设计“'添加到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)

的Gemfile:

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

1 个答案:

答案 0 :(得分:0)

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

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