如何在Rails初始化方法中获取有关错误的更多信息?

时间:2015-06-30 00:11:25

标签: ruby-on-rails ruby

我试图卸载gem并删除依赖它的代码。我删除了它需要的gem和文件夹/文件,但是在项目的某个地方有代码试图加载一些不存在的东西:

LoadError: No such file to load -- /Users/andrewlangdon/workspace/chorus/app/permissions/insight_access
           depend_on at /Users/andrewlangdon/.rvm/gems/jruby-1.7.13/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:317
           depend_on at /Users/andrewlangdon/.rvm/gems/jruby-1.7.13/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:313
  require_dependency at /Users/andrewlangdon/.rvm/gems/jruby-1.7.13/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:225
         eager_load! at /Users/andrewlangdon/.rvm/gems/jruby-1.7.13/gems/railties-3.2.18/lib/rails/engine.rb:444
                each at org/jruby/RubyArray.java:1613
         eager_load! at /Users/andrewlangdon/.rvm/gems/jruby-1.7.13/gems/railties-3.2.18/lib/rails/engine.rb:443
                each at org/jruby/RubyArray.java:1613
         eager_load! at /Users/andrewlangdon/.rvm/gems/jruby-1.7.13/gems/railties-3.2.18/lib/rails/engine.rb:441
            Finisher at /Users/andrewlangdon/.rvm/gems/jruby-1.7.13/gems/railties-3.2.18/lib/rails/application/finisher.rb:53
       instance_exec at org/jruby/RubyBasicObject.java:1562
                 run at /Users/andrewlangdon/.rvm/gems/jruby-1.7.13/gems/railties-3.2.18/lib/rails/initializable.rb:30
    run_initializers at /Users/andrewlangdon/.rvm/gems/jruby-1.7.13/gems/railties-3.2.18/lib/rails/initializable.rb:55
                each at org/jruby/RubyArray.java:1613
    run_initializers at /Users/andrewlangdon/.rvm/gems/jruby-1.7.13/gems/railties-3.2.18/lib/rails/initializable.rb:54
         initialize! at /Users/andrewlangdon/.rvm/gems/jruby-1.7.13/gems/railties-3.2.18/lib/rails/application.rb:137
      method_missing at /Users/andrewlangdon/.rvm/gems/jruby-1.7.13/gems/railties-3.2.18/lib/rails/railtie/configurable.rb:30
              (root) at /Users/andrewlangdon/workspace/chorus/config/environment.rb:5
             require at org/jruby/RubyKernel.java:1065
              (root) at /Users/andrewlangdon/workspace/chorus/spec/spec_helper.rb:1
             require at org/jruby/RubyKernel.java:1065
              (root) at /Users/andrewlangdon/workspace/chorus/spec/spec_helper.rb:4
                load at org/jruby/RubyKernel.java:1081
              (root) at /Users/andrewlangdon/workspace/chorus/spec/concerns/searchable_html_spec.rb:1
                each at org/jruby/RubyArray.java:1613
              (root) at /Users/andrewlangdon/workspace/chorus/spec/concerns/searchable_html_spec.rb:1
              (root) at /Users/andrewlangdon/.rvm/gems/jruby-1.7.13/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:1
     load_spec_files at /Users/andrewlangdon/.rvm/gems/jruby-1.7.13/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896
     load_spec_files at /Users/andrewlangdon/.rvm/gems/jruby-1.7.13/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896

我最后猜测有人放了一个随机require而不是遵循正常模式,我在查看代码库中的每个require调用后找到并删除了有问题的行。

是否有更好/更简单的方式从LoadError获取更多信息?

1 个答案:

答案 0 :(得分:1)

我本可以全球搜索" insight_access"这似乎是它无法找到的文件(从错误的第一行开始)。