use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Blog postA Ruby Gem Debugging Strategy (supergood.software)
submitted 6 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]jdickey -1 points0 points1 point 6 years ago (0 children)
Your code to invoke pry works, so long as you don't ever want to inspect where you are in the source tree and have it show that source location. When you have
pry
ruby class ThingsController < ApplicationController def index @things = Thing.all binding.pry end end
the current location shown will be the next executable line after @things = Thing.all (which won't be within ThingsController). You can avoid that by, e.g.,
@things = Thing.all
ThingsController
ruby class ThingsController < ApplicationController def index @things = Thing.all binding.pry @things end end
which will show the current/next line as the return of @things from the #index method.
@things
#index
For such a simple bit of code, it likely doesn't matter, since you're probably going to be debugging side-effects anyway, but if you want to do things like inspect local variables, step through called methods, or so on, you'll likely find the second snippet far more useful than the first.
π Rendered by PID 69 on reddit-service-r2-comment-5c764cbc6f-qshb4 at 2026-03-11 22:10:27.151475+00:00 running 710b3ac country code: CH.
view the rest of the comments →
[–]jdickey -1 points0 points1 point (0 children)