错误 - 未初始化的常量Devise :: IndifferentHash(NameError)

时间:2011-10-31 14:20:06

标签: ruby-on-rails-3 error-handling generator rubymine

在rails中工作,我正在尝试命令'rails g spree:site',如Spree getting Started Guide第4.5节所述。不确定是什么问题,我在Windows 7平台上运行rails 3.1.1.rc2。错误如下。

    C:/Ruby192/lib/ruby/gems/1.9.1/gems/spree_auth-0.40.0/lib/spree_auth.rb:17:in `a
ctivate': uninitialized constant Devise::IndifferentHash (NameError)
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1.rc2/lib/act
ive_support/callbacks.rb:413:in `_run_prepare_callbacks'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1.rc2/lib/act
ive_support/callbacks.rb:81:in `run_callbacks'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.1.1.rc2/lib/action
_dispatch/middleware/reloader.rb:46:in `prepare!'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1.rc2/lib/rails/ap
plication/finisher.rb:41:in `block in <module:Finisher>'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1.rc2/lib/rails/in
itializable.rb:29:in `instance_exec'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1.rc2/lib/rails/in
itializable.rb:29:in `run'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1.rc2/lib/rails/in
itializable.rb:54:in `block in run_initializers'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1.rc2/lib/rails/in
itializable.rb:53:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1.rc2/lib/rails/in
itializable.rb:53:in `run_initializers'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1.rc2/lib/rails/ap
plication.rb:96:in `initialize!'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1.rc2/lib/rails/ra
iltie/configurable.rb:30:in `method_missing'
        from C:/Users/Edu/RubymineProjects/myStore/config/environment.rb:5:in `<
top (required)>'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1.rc2/lib/rails/ap
plication.rb:83:in `require_environment!'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1.rc2/lib/rails/co
mmands.rb:22:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

2 个答案:

答案 0 :(得分:0)

我在使用rails 3.1时遇到了同样的问题。解决方案是将以下几行放在我的GEMFILE中:

# ===:git with the repository's url that works=== #
gem 'spree', :git => 'git://github.com/spree/spree.git' 

这对你的情况也有帮助。

答案 1 :(得分:0)

@ jhsilva007:指定此行(gem'spree',:git =&gt;'git://github.com/spree/spree.git')

肯定帮我解决了错误。

我认为这一行将从github获得最新版本的spree。如果我只想要特定版本的狂欢怎么办?我的意思是我不喜欢获得测试版。