binding.pry
is a cool command and many people use it. But it's too much to type each time. What is the best way to add a shorthand for it, something like
bp
Please don't suggest putting a
$bp = binding.pry
into initializers but anything without the dollar sign?
So, after a little thought, here's the solution. It will require one more next
to hit. But there are the other benefits - you can define it per environment, so you'll never get an error on production if you forget to delete or comment out bp
.
Go to initializers, and create pry.rb file with these contents:
def bp
unless %w(production).include? Rails.env
binding.pry
end
end
Have fun!