1

i want to debug ROR without going through the effort of putting inspect method for every relevant object in the controller as well in the model.is there a better way as we have in Java (Run time debugger using eclipse).i know that I can Use Rails.logger and also make use of rails Console(irb`).i am even aware of debugging/inspecting elements in erb/rb file.Still is there a better,quick and reliable way to debug a Rails app.

1
  • There are some console debuggers. RubyMine offers visual debugger (or so they say, I have never used it. Debug printing is usually enough for me). Commented Mar 20, 2013 at 11:06

3 Answers 3

3

There is much better, see this railscats.

It presents two great gems, especially Better Errors

Otherwise, you could use pry with rails, see this railscast.

Sign up to request clarification or add additional context in comments.

2 Comments

better_errors is hardly a debugger replacement. What if there's no error, and just a breakpoint?
you can also throw in a raise where you want the equivalent of a breakpoint when using better_errors. I agree though, it's not a replacement. Different people like different methods though
1

you can also use pry-rails, pry-debugger and then use binding.pry method in your code and then while using your app you have Rails console available in rails server

Comments

0

Add this lines to your application's Gemfile

group :development do
  gem 'ruby-debug19'
end

then run cammand

 bundle install

add debugger within your controller or model method, stop the rails server and restart again. Whenever rails found word debugger it stops control at that point. You can easily debug your value or object. Hope this will helps you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.