An alternative IRB shell and Ruby debugger for your apps.
This great tip that I bring to you today guys, is something that I found when I was coding and got stuck trying to debug my application.
I found this gem named PRY, a cool gem that allows you to have an alternative IRB shell and also works as a debugger for ruby.
Go to your Gemfile and write the following line:
Then go to your terminal and:
$ bundle install
After that, pry will be ready to be used within your application.
You can use pry as a shell, but, also as a debugger.
You can use it in your controllers and in your views:
<%- binding.pry %>
Restart your server
Go to your localhost app, and then browse to the page where you used the lines above. You will experiment a frozen website, now, you are ready to go to your console and see the received parameters, methods, etc.
If you want to stop just write:
and your server will be running again.
If you want more information related to pry, go to its Github repository https://github.com/pry/pry/
Thanks for reding me!, I hope I have been of some help to you.
Follow me on twitter @zazvick and stay in touch!