¿Cómo depurar correctamente en 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!

preguntado el 26 de noviembre de 13 a las 23:11

1 Respuestas

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

respondido 26 nov., 13:23

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.