Having been with Rails in just 5 years, I do not consider myself an advanced Railser, but, nevertheless, I gladly shared my knowledge. :-)
The main thing when dealing with anyone (with the exception of some very, very trivial ones) is to write a test for this error .
Several times it happened that I solved the error at this stage - for example, when the error was associated with a reload of the automatic class, which is active in development and disabled in test mode.
Then I usually place some logger.debug with lots of inspect and caller(0).join("\n\t") . Then I study the log file very carefully.
Since "test.log" can have several hundred megabytes, I always forget to reset it to zero before starting the test. In addition, I usually run only one test method at a time, because the output would be unreadable otherwise.
I do not use a dedicated debugger. In some old version of ruby, the debugger stops working, I learned how to live without it and never looked back.
A few useful utilities that may be useful:
A function defined in my ~/.bashrc that allows me to call one test method (or group of methods):
$ testuj test/unit/user_test.rb -n test_name_validations $ testuj test/unit/user_test.rb -n /_name_/
function testuj () { if [ -n "${BUNDLE_GEMFILE}" ] then
And this method helps me with logging and checking the timing of certain steps:
Object.module_eval do def czekpoint(note = nil) n = Time.now $czekpoint_previous ||= n $czekpoint_number ||= 0 $czekpoint_number += 1 t = n - $czekpoint_previous msg = "CZEKPOINT: %2d %8.6f %s %s" % [$czekpoint_number, t, caller.first.to_s.in_yellow, note.to_s.in_red] Rails.logger.debug msg