I'm trying to debug a Rails 4.1.1 app using binding.pry
but more often than not when the execution breaks and I try to show the values of my variables it just returns an empty string, or nothing (hard to distinguish).
But other times it spits out the values. I've noticed that it's more likely to spit out the value of a variable if that variable is holding a very long piece of text or JSON. Otherwise it's just ignored.
Likewise trying to do other basic binding.pry
things like !
to reset the input buffer or hist --tail 5
etc are just ignored.
Rails is being started via foreman
and running in thin
.
My guess is it's some sort of output synchronisation issue but that's just a guess.
Have you experienced this and, if so how did you deal with it?
Are you using pry-debugger
? If so, with Ruby 2+, you may want to change to pry-byebug. There is some kind of linecache
incompatibility between Ruby 1.9 & 2.x, and byebug
fixes that.