I really love using binding.pry as my debugger because of Pry's ls command.
If you want to always load pry in your irb and rails console, just add a .irbrc to your project root with the following lines:
begin
require "pry"
Pry.start
exit
rescue LoadError
warn "=> Unable to load pry"
end
And if you're using Rails and still want to be able to call reload! or helpers on the rails console, also add a config/initializers/pry.rb with these contents:
if defined?(Pry)
require "rails/console/app"
require "rails/console/helpers"
TOPLEVEL_BINDING.eval('self').extend ::Rails::ConsoleMethods
end
Posted by Judith Roth to Judith's Dev Notes (2022-07-07 20:35)