Search code examples
debuggingjrubyjrubyonrailspry

JRuby 1.7.15, Rails 4, pry, debugger


Recently, i have migrated my application on Ruby on Rails 4 to JRuby 1.7.15 with Rails 4.

when i execute bundle, I have got following error :

An error occurred while installing debugger (1.6.8), and Bundler cannot continue. Make sure that gem install debugger -v '1.6.8' succeeds before bundling.

I understand, debugger doesn't work with JRuby. But how use "gem pry" with JRuby ?

Thank for your help


Solution

  • Using pry with jruby is not different from using it with any other ruby and the debugger gem is not neccesary. The pry ecosystem is also a much superior solution.

    Using pry with rails is most easiest with 'pry-rails' gem. Just add it to your Gemfile than call

    binding.pry  
    

    at any place in your code in order to set a breakpoint