Alex Rivera | Logout

How to debug in Model?

Asked 2010-08-15T13:39:29.843
17

Does anybody know how to debug in rails in the Model? I have a method that is now working and I was trying to check the variable's value in between typing logger.debug val_name that's working in the controllers but not in the models does anyone know why? The model is not inherited from Active Record if it can be the problem. Is there any way to debug it?

Edit
Report

1 Answer

0

If you are spinning up Mongrel using script/server in development, this might work:

  1. installe the ruby-debug gem, if you don't have it already: gem install ruby-debug;
  2. add require 'ruby-debug' to config/environments/development.rb;
  3. put the line debugger in the source where you want to initiate a debugging session.

Look at this official guide for more information: http://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-ruby-debug

answered 2010-08-15T17:41:42.097

Your Answer