Milind
Milind

Reputation: 5112

Debugging in rails 3

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.

Upvotes: 1

Views: 470

Answers (3)

Sachin R
Sachin R

Reputation: 11876

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.

Upvotes: 0

mkozak
mkozak

Reputation: 419

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

Upvotes: 1

apneadiving
apneadiving

Reputation: 115511

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.

Upvotes: 3

Related Questions