2

I'm looking for a good solution to debug my application(written on Rails 2) and I found pry very helpful. How can I use it in a Rails 2 app, tried and it doesn't seem to be working? Is there an alternative?

Coding active
  • 1,620
  • 3
  • 23
  • 40
  • Pry is a general-purpose Ruby console/debugger. Rails is just a Ruby framework. Why wouldn't it work? – Thomas May 30 '14 at 09:20

2 Answers2

2
script/console --irb=pry

see: https://github.com/pry/pry/wiki/Setting-up-Rails-or-Heroku-to-use-Pry

George Sun
  • 116
  • 1
  • 5
1

Add pry to gemfile:

gem 'pry'

Run bundle install

Then to launch a console with pry:

RAILS_ENV=production bundle exec pry -r config/environment.rb

Or add a binding.pry somewhere in your code as a breakpoint.

Kimmo Lehto
  • 5,910
  • 1
  • 23
  • 32