Questions tagged [byebug]

Byebug is a simple to use, feature rich debugger for Ruby 2.0.

Byebug is a Ruby 2.0 debugger. It's implemented using the Ruby 2.0 TracePoint C API for execution control and the Debug Inspector C API for call stack navigation. The core component provides support that front-ends can build on. It provides breakpoint handling and bindings for stack frames among other things and it comes with an easy to use command line interface.

When your code is behaving in unexpected ways, you can try printing to logs or the console to diagnose the problem. Unfortunately, there are times when this sort of error tracking is not effective in finding the root cause of a problem. When you actually need to journey into your running source code, the debugger is your best companion.

The debugger can also help you if you want to learn about the Rails source code but don't know where to start. Just debug any request to your application and use this guide to learn how to move from the code you have written deeper into Rails code.

Homepage

Guide

119 questions
1
vote
0 answers

Byebug does not pauses in controller in RSpec request spec

I have added byebug breakpoint in spec code and it pauses the code there. require 'rails_helper' RSpec.describe "UsedCars", :type => :request do describe "POST /used_cars" do it "creates a used car ad" do byebug # <- stop here …
Heir Of Knowledge
  • 617
  • 1
  • 6
  • 13
1
vote
1 answer

How to use helpers in pry-byebug?

In the rails console, we can prepend helper. to helpers to use them, like so: helper.time_ago_in_words(Time.now - 60*60*2) but this doesn't work in the server console during a pry-byebug debugging How can I use a method like time_ago_in_words after…
stevec
  • 41,291
  • 27
  • 223
  • 311
1
vote
3 answers

How to copy multiple lines of code into byebug?

byebug doesn't seem to be able to handle multiple lines of code. Example I put byebug into the controller, and the next lines of code are (these could be anything, just an example here): payment_intent = Stripe::PaymentIntent.create({ …
stevec
  • 41,291
  • 27
  • 223
  • 311
1
vote
1 answer

Logging on to My Rails Server, My ByeBug isn't Working?

Here is my github to my project. I put byebug into all of my controller actions to debug this login form...

Login

<%= form_with model: @user do |form| %> <%= render "partials/usererrorform" %> <%= form.label :user_name %> <%=…
Kim
  • 23
  • 7
1
vote
1 answer

How to increase the number of lines around binding.pry?

Using the gem pry-byebug, when I add a binding.pry somewhere, it shows only 5 lines around the line that I am: 157: max_bytes: limits_config.max_read_bytes_per_parser, 158: max_reads: limits_config.max_reads_per_parser, 159: …
Fabio Perrella
  • 403
  • 5
  • 6
1
vote
0 answers

ByeBug is going too deep. Stepping into RubyCore files on 'next'

I am using "byebug" in a Ruby program. As I "next" through the program "ByeBug" is going too deep and is steping into ruby/core. This has never happened before. Is there a setting I can adjust to make it so ByeBug doesn't 'next' into the Ruby source…
seamus
  • 2,681
  • 7
  • 26
  • 49
1
vote
0 answers

Debug child ruby cgi process spawned by webrick by redirecting stdin and stdout

The problem: byebug or pry output is returning via HTTP instead of on console. I have a webrick.rb script which has a CGIHandler mounted with a dispatch.fcgi script passed to it: server.mount("/", WEBrick::HTTPServlet::CGIHandler,…
raven
  • 11
  • 2
1
vote
1 answer

byebug: Don't confirm on quit

Is there a way to configure byebug so that it does not ask to confirm before exiting when issuing a quit command ? (byebug) quit Really quit? (y/n)
port5432
  • 5,889
  • 10
  • 60
  • 97
1
vote
1 answer

error when try install byebug

I get the error when I try to install byebug. What's the reason for this? sudo gem install byebug -v '10.0.1' Building native extensions. This could take a while... ERROR: Error installing byebug: ERROR: Failed to build gem native extension. …
Yuri Melo
  • 93
  • 1
  • 3
  • 12
1
vote
1 answer

Rails using byebug inside a proc?

I am trying to use byebug/debugger inside a proc that gets called later with threads, but its not working. So how can I Debug code inside a proc?
Achyut Rastogi
  • 1,335
  • 2
  • 11
  • 15
1
vote
0 answers

undefined local variable or method `byebug', already in Gemfile and required

I have the same problem as this question. I use byebug in this class: class BasesController < ApplicationController before_action :set_available_bases, only: [:index] def index end private def set_available_bases byebug @bases =…
garci560
  • 2,993
  • 4
  • 25
  • 34
1
vote
1 answer

What are the performance implications of including Ruby IRB shell gems in production? (i.e. Pry / Byebug / awesome_print ...)

In Rails projects its common to see shell-enhancement gems only being included in the development / test sections of Gemfiles -- presumably because there is a performance or memory hit if these gems were included into the production…
Kelsey Hannan
  • 2,857
  • 2
  • 30
  • 46
1
vote
2 answers

Debugger causes internal server error

I can no longer place debugger in my controller methods. I test API calls with Chrome's Postman. Methods all work but if I include debugger in a method (irrespective which method and irrespective the position I place debugger in the method) and call…
Marty
  • 2,132
  • 4
  • 21
  • 47
1
vote
2 answers

Rails bundle install fails because "byebug requires ruby version >= 2.0.0"

I tried on ruby versions 2.0.0, 2.1.5 and 2.2.1. Also gem install byebug -v '5.0.0' installs byebug succesfully. byebug -v returns: Running byebug 5.0.0, but bundle install still fails and gives me error "byebug requires ruby version >= 2.0.0".
MeesterPatat
  • 2,671
  • 9
  • 31
  • 54
1
vote
2 answers

Rails .all returns a Relation with objects, but .count and .all.to_a doesn't return anything

I'm currently having a very weird issue at the moment. I have an ExportFile model. Within a byebug console inside the tests, if I call .all, I see: >>> ExportFile.all #
linkyndy
  • 17,038
  • 20
  • 114
  • 194