[英]How to debug properly in Rails?
I'm using debugger in my code in multiple apps. 我在多个应用程序的代码中使用调试器。 However, I usually have to debug because of loops where one specific thing went wrong.
但是,我通常必须调试,因为循环中有一个特定的东西出了问题。 Is there a way to let the debugger fast forward or autopilot to the point where I hit an error?
有没有办法让调试器快进或自动驾驶到我遇到错误的地步? I'm sick of using 'next' over and over until I get to the correct point in the loop!
我厌倦了一遍又一遍地使用'next',直到我到达循环中的正确点!
You can call the debugger statement with a conditional. 您可以使用条件调用调试器语句。 Something like this:
像这样的东西:
my_collection.each do |l|
debugger if l.has_some_bad_condition?
# ...
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.