The ruby-debug gem is great for debugging but here’s something you might have missed: you can call it with a condition. That way it only breaks execution when a given condition is met.
[3, 2, 15, nil, 5].collect do |id| debugger if id.nil? id.to_s end
That way, it will only stop if one of the array items is nil. This is a huge time-saver. Use it frequently.