Can you start
pry early in the Rails booting process, such as in an initializer file?
If you just put in a
binding.pry inside one of your initializer files, you’ll probably see a warning like this. Assume the top-level directory of your project is
Error: Cannot open "/Users/my_name/projects/my_project/<main>" for reading.
Needs require to load pry correctly
The fix for this is to put these two lines at the top of the file where you’re trying to use
require 'pry' require 'pry-byebug
For example, here’s the sample config:
To add a
binding.pry to that file to do some exploration, just add those two requires to the top of the initializer file.
And when you clean up your
binding.pry, don’t forget to remove the extra requires!