Rails Byebug Did Not Stop Application
When using docker-compose
in combination with byebug
this needs to be added to make it work properly. Found in this blog post
Add this to docker-compose.yml
web:
...
stdin_open: true
tty: true
Then run docker-compose in deamonized mode and attach to the web container with docker:
docker-compose up -d
docker attach myappname_web_1
byebug, next into application code only
I use c n
to continue to a particular line n
. Byebug will run at full-speed, then stop at the line you gave it. That means that gems or not, they won't be noticed by you as they'll be processed at high-speed.
The built-in help says:
(byebug) help continue
c[ont[inue]][ nnn]
Run until program ends, hits a breakpoint or reaches line nun
Reasons rails is not stopping at debugger
This is a known issue in the debugger gem, see here (bullet point number three).
It seems that you are interested in why it doesn't work. The following is the explanation:
What debugger does is watching some events provided by ruby that tell the debugger when to stop. In this case, the debugger tracks what we call a
line event
that is triggered once per line executed, so in the case of the last line of a method, the debugger will stop in the next line event, which actually happens outside the method that is being debugged.In byebug, however, I also track what we call
return events
, that are called every time a method finishes. That's why I'm able to stop execution before the method actually finishes.
Hope this helps.
Ruby byebug never stops
I had downgrade to a lower version of byebug and it works. Not sure what incompatibilities there may have been with the latest version. Using 3.5.1 worked for me.
gem 'byebug', '~> 3.5.1'
Related Topics
Custom Gem Execution Fails with Nomethoderror
How to Write a Method That Counts the Most Common Substring in a String in Ruby
Sorting of 2D Array by Its Amount of in the Inner Elements
Error When Pushing to Heroku - ...Appear in Group - Ruby on Rails
Error: Missing Rvm Environment File After Doing Rvm Upgrade Command - Passenger 4.0.23
Why Does the Script Affect Everything on My Rails 3 App Even When Cased in This Code
How to Render the Ajax Response in Rails
Deleting Blank Lines After Loop
Replacing an Element in Nested Array Ruby
Differencebetween 'Raise "Foo"' and 'Raise Exception.New("Foo")'
How to Install Nokogiri on MAC Os Sierra 10.12
Recurring Billing with Rails and Activemerchant: Best Practices, Pitfalls, Gotchas
Practical Example of Architecture Using Ebc