Debugging information can help you understand what’s going on in your application. After Rails 5 and before Rails 7, the
byebug gem was responsible for tracking the execution flow. It has been providing a way to view a complete backtrace of the code while working on the application. Rails 7 introduces
debug as its default debugger.
debug comes from Ruby 3.1 standard library and will align Rails with Ruby. It also supports remote debugging natively, as well as recording and reply debugging. More about the gem can be found here.
debug can be called with
binding.break method (aliases:
1 2 3 4 5 6 7 8 class UsersController < ApplicationController def index name = "John" surname = "Smith" binding.break # Call to debugger place = "New York" end end
The new debugger is also contains methods like