如何读取与 Lockdown gem 相关的失败 Rails 迁移的跟踪

发布于 2024-08-12 19:52:55 字数 5140 浏览 2 评论 0原文

通常,当我收到错误时,跟踪将指向我自己的代码中的一行。我将转到该行,找到错误并修复它。

然而,现在跟踪指向 Rails 和 gem 代码,我不知道如何使用它来调试我的工作。

我一直按照此处列出的步骤进行操作。

当我运行 rake db:migrate --trace 时,我得到如下所示的跟踪。我并不是要求任何人为我调试它,但如果您能在调试时指出您要寻找的内容,我将不胜感激。

rake db:migrate --trace
(in /Users/steven/Drominay)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
=> Mixing in Lockdown version: 1.6.2 

rake aborted!
uninitialized constant Lockdown::Frameworks::Rails::Environment::ApplicationController
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:442:in `load_missing_constant'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:77:in `const_missing'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown/frameworks/rails.rb:70:in `controller_parent'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown/frameworks/rails.rb:29:in `mixin_controller'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown/frameworks/rails.rb:18:in `mixin'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown/frameworks/rails.rb:14:in `included'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown.rb:72:in `include'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown.rb:72:in `mixin_resource?'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown.rb:67:in `each'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown.rb:67:in `mixin_resource?'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown.rb:43:in `mixin'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown.rb:85
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:155:in `require'
/Users/steven/Drominay/config/initializers/lockit.rb:1
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:144:in `load_without_new_constant_marking'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:144:in `load'
/Users/steven/.gem/ruby/1.8/gems/rails-2.2.2/lib/initializer.rb:550:in `load_application_initializers'
/Users/steven/.gem/ruby/1.8/gems/rails-2.2.2/lib/initializer.rb:549:in `each'
/Users/steven/.gem/ruby/1.8/gems/rails-2.2.2/lib/initializer.rb:549:in `load_application_initializers'
/Users/steven/.gem/ruby/1.8/gems/rails-2.2.2/lib/initializer.rb:167:in `process'
/Users/steven/.gem/ruby/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in `send'
/Users/steven/.gem/ruby/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in `run'
/Users/steven/Drominay/config/environment.rb:14
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
/Users/steven/.gem/ruby/1.8/gems/rails-2.2.2/lib/tasks/misc.rake:3
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

More often than not, when i get an error the trace will point to a line in my own code. I'll go to that line, find the error and fix it.

However, right now the trace is pointing to Rails and gem code, and I'm not sure how to use it to debug my work.

I've been following the steps listed here.

When I run rake db:migrate --trace, I get the trace shown below. I'm not asking anyone to debug it for me, but I'd appreciate any pointers to what you would look for when debugging this.

rake db:migrate --trace
(in /Users/steven/Drominay)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
=> Mixing in Lockdown version: 1.6.2 

rake aborted!
uninitialized constant Lockdown::Frameworks::Rails::Environment::ApplicationController
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:442:in `load_missing_constant'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:77:in `const_missing'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown/frameworks/rails.rb:70:in `controller_parent'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown/frameworks/rails.rb:29:in `mixin_controller'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown/frameworks/rails.rb:18:in `mixin'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown/frameworks/rails.rb:14:in `included'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown.rb:72:in `include'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown.rb:72:in `mixin_resource?'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown.rb:67:in `each'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown.rb:67:in `mixin_resource?'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown.rb:43:in `mixin'
/Library/Ruby/Gems/1.8/gems/lockdown-1.6.2/lib/lockdown.rb:85
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:155:in `require'
/Users/steven/Drominay/config/initializers/lockit.rb:1
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:144:in `load_without_new_constant_marking'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:144:in `load'
/Users/steven/.gem/ruby/1.8/gems/rails-2.2.2/lib/initializer.rb:550:in `load_application_initializers'
/Users/steven/.gem/ruby/1.8/gems/rails-2.2.2/lib/initializer.rb:549:in `each'
/Users/steven/.gem/ruby/1.8/gems/rails-2.2.2/lib/initializer.rb:549:in `load_application_initializers'
/Users/steven/.gem/ruby/1.8/gems/rails-2.2.2/lib/initializer.rb:167:in `process'
/Users/steven/.gem/ruby/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in `send'
/Users/steven/.gem/ruby/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in `run'
/Users/steven/Drominay/config/environment.rb:14
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
/Users/steven/.gem/ruby/1.8/gems/rails-2.2.2/lib/tasks/misc.rake:3
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

┈┾☆殇 2024-08-19 19:52:55

根据本文,通过将 application.rb 更改为 application_controller.rb 来修复。

(但是仍然对如何实际使用此跟踪感兴趣。)

Fixed by changing application.rb to application_controller.rb, as per this article.

(Still interested in how to practically use this trace however.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文