错误“未初始化的常量Rails :: Engine(NameError)”

时间:2011-03-03 22:10:40

标签: ruby-on-rails ruby rubygems

我正在尝试加入Rails项目。这个项目使用rails 2.3.8和Ruby 1.8.7,所以我使用的是RVM。我也在使用gem v1.3.7

当我启动服务器时,一切正常。但是,当我尝试通过浏览器访问它时,它会崩溃并且我得到以下跟踪:

/Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant Rails::Engine (NameError)
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in `const_missing'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/devise_invitable-0.3.6/lib/devise_invitable/rails.rb:2
        from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/devise_invitable-0.3.6/lib/devise_invitable.rb:16
        from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/rails/gem_dependency.rb:215:in `load'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/initializer.rb:307:in `load_gems'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/initializer.rb:307:in `each'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/initializer.rb:307:in `load_gems'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/initializer.rb:169:in `process'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/initializer.rb:113:in `send'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/initializer.rb:113:in `run'
        from /Users/ca/Documents/Project/Sources/Project-test/config/environment.rb:9
        from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
        from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/commands/server.rb:84
        from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from ./script/server:3

以下是我安装的宝石:

actionmailer (2.3.8)
actionpack (2.3.8)
activemodel (3.0.5)
activerecord (2.3.8)
activeresource (2.3.8)
activesupport (3.0.5, 2.3.8)
addressable (2.2.4)
arel (2.0.9)
aws (2.4.4)
aws-s3 (0.6.2)
bcrypt-ruby (2.1.4)
builder (3.0.0, 2.1.2)
client_side_validations (2.9.9)
crack (0.1.8)
daemons (1.1.0)
dalli (1.0.2)
delayed_job (2.0.3)
devise (1.1.7)
devise_invitable (0.3.6)
faraday (0.5.7, 0.4.6)
fb_graph (1.5.3)
googlecharts (1.6.1)
http_connection (1.4.0)
httparty (0.7.4)
i18n (0.5.0)
json (1.5.1, 1.4.3)
mime-types (1.16)
multi_json (0.0.5)
multipart-post (1.1.0)
net-ldap (0.1.1)
nokogiri (1.4.4)
oa-basic (0.1.5)
oa-core (0.1.5)
oa-enterprise (0.1.5)
oa-oauth (0.1.5)
oa-openid (0.1.5)
oauth (0.4.4)
oauth2 (0.1.1, 0.0.13)
omniauth (0.1.5)
paperclip (2.3.8)
pyu-ruby-sasl (0.0.3.2)
rack (1.1.1)
rack-openid (1.1.2)
rails (2.3.8)
rake (0.8.7)
RedCloth (4.2.7)
rest-client (1.6.1)
ruby-openid (2.1.8)
ruby-openid-apps-discovery (1.2.0)
rubygems-update (1.3.7)
rubyntlm (0.1.1)
tzinfo (0.3.24)
uuidtools (2.1.2)
validates_timeliness (2.3.0)
validation_reflection (0.3.7)
validation_reflection-active_model (0.3.1)
warden (1.0.3)
will_paginate (2.3.15)
xml-simple (1.0.14)

问题出在哪里?

非常感谢你的帮助!

1 个答案:

答案 0 :(得分:0)

您的DeviseInvitable版本对于Rails 2.3来说太新了。

  

DeviseInvitable目前只支持Rails 3,如果你想在Rails 2.3中使用它,你必须安装版本0.2.3

与Devise 1.1一样

  

通过从v1.0分支安装Devise 1.0.x可以找到对Rails 2.3.x的支持。

运行

gem uninstall devise devise_invitable
gem install devise --version 1.0.10
gem install devise_invitable --version 0.2.3