I am making my way from Django to Rails. So far I just created a new Rails app and found in the Gemfile
this line:
# Call 'debugger' anywhere in the code to stop execution and get a
# debugger console
gem 'byebug'
How this supposed to work? Is it as straightforward as it said in the comment? I can put debugger
somewhere in code and get a debugger console in my browser?
start rails server
rails s
and monitor the logs.
Now try accessing the page which points to the place where debugger
is written in the code
The log will stop at a point where you have put the debugger
/byebug
word.
You can print out variables at that instant
update for rails 4
On suggestion of Deivid, I would like to quote him here
drop the --debug flag. You don't need to do anything special to make byebug work in Rails 4. Just require 'byebug' and call byebug
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With