Rspec,Capybara,Guard-未初始化的常量ActiveRecord::Base(NameError)

Rspec,Capybara,Guard-未初始化的常量ActiveRecord::Base(NameError),activerecord,rspec,ruby-on-rails-3.2,capybara,Activerecord,Rspec,Ruby On Rails 3.2,Capybara,当我启动guard并保存rspec请求时,我总是会收到此错误 我参考了这个教程 未初始化的常量ActiveRecord::Base(NameError) 见下文 /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record/audit.rb:16:in `<module:ActiveRecord>': uninitialized cons

当我启动guard并保存rspec请求时,我总是会收到此错误

我参考了这个教程

未初始化的常量ActiveRecord::Base(NameError)

见下文

/home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record/audit.rb:16:in `<module:ActiveRecord>': uninitialized constant ActiveRecord::Base (NameError)
    from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record/audit.rb:6:in `<module:Adapters>'
    from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record/audit.rb:5:in `<module:Audited>'
    from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record/audit.rb:4:in `<top (required)>'
    from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record.rb:3:in `<top (required)>'
    from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited-activerecord.rb:2:in `<top (required)>'
    from /home/think/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
    from /home/think/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /home/think/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
    from /home/think/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
    from /home/think/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
    from /home/think/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
    from /home/think/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
    from /home/think/jonathan/organizor/config/application.rb:7:in `<top (required)>'
    from /home/think/jonathan/organizor/config/environment.rb:2:in `require'
    from /home/think/jonathan/organizor/config/environment.rb:2:in `<top (required)>'
    from /home/think/jonathan/organizor/spec/spec_helper.rb:3:in `require'
    from /home/think/jonathan/organizor/spec/spec_helper.rb:3:in `<top (required)>'
    from /home/think/jonathan/organizor/spec/requests/password_resets_spec.rb:1:in `require'
    from /home/think/jonathan/organizor/spec/requests/password_resets_spec.rb:1:in `<top (required)>'
    from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load'
    from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
    from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `each'
    from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load_spec_files'
    from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:22:in `run'
    from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:80:in `run'
    from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:17:in `block in autorun'
/home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active\u record/audit.rb:16:in`':未初始化常量activerecord::Base(NameError)
from/home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active\u record/audit.rb:6:in`'
from/home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record/audit.rb:5:in`'
from/home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active\u record/audit.rb:4:in`'
from/home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record.rb:3:in`'
from/home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited-activerecord.rb:2:in`'
from/home/think/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in'require'
from/home/think/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in'block(2层)in require'
from/home/think/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in'each'
from/home/think/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in'block in require'
from/home/think/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in'each'
from/home/think/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in'require'
from/home/think/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler.rb:128:in'require'
from/home/think/jonathan/organizer/config/application.rb:7:in`'
from/home/think/jonathan/organizer/config/environment.rb:2:in'require'
from/home/think/jonathan/organizer/config/environment.rb:2:in`'
from/home/think/jonathan/organizer/spec/spec_helper.rb:3:in'require'
from/home/think/jonathan/organizer/spec/spec\u helper.rb:3:in`'
from/home/think/jonathan/organizer/spec/requests/password\u resets\u spec.rb:1:in'require'
from/home/think/jonathan/organizer/spec/requests/password\u resets\u spec.rb:1:in`'
from/home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in'load'
from/home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:“加载规范文件中的块”
from/home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in'each'
from/home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:在“加载规范文件”中
from/home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/command_-line.rb:22:in'run'
from/home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:80:in'run'
from/home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:17:in“自动运行中的块”

我还没有做过rails测试。这是我第一次。我当然知道我错过了一些配置。请帮助。

这太神奇了,我在lib目录中有一个名为“active_record.rb”的空文件,这个文件是被加载的,而不是rails ActiveRecord。因此,出现了未初始化的名称错误。伙计们,小心你们将要保存在lib下的类的名称。它覆盖了

天哪,吃了一天才弄明白