Getting started with byebug in Rails

I am going from Django to Rails. So far, I just created a new Rails application and found on Gemfilethis line:

  # Call 'debugger' anywhere in the code to stop execution and get a
  # debugger console
  gem 'byebug'

How should this work? Is it as simple as the comment says? Can I post debuggersomewhere in the code and get the debugger console in my browser?

+4
source share
2 answers

launch rails server

rails s

and keep track of magazines.

enter image description here

Now try to access a page that points to the place where debuggerit is written in the code. The log will stop at the point where you put the word debugger/ byebug.

enter image description here You can print the variables at this moment

upgrade for rails 4

.

-debug. , byebug Rails 4. "byebug" byebug

+5

- debugger byebug beebug , rails ( , , rails - , ).

, , web-console gem ( rails 4.2 ). console ( , ..) IRB

+1

All Articles