I know this has come up before, but I thought people might be
interested in a slightly different way of attaching rdebug to rails
running in passenger. The old way I've seen and used is to check for a
file (tmp/debug.txt) in the development.rb file and run
Debugger.start_remote at that point. Annoying thing with that is that
you have to run rake restart DEBUG=true each time you want to attach.
Add the following to your development.rb file and it will wait for the
remote debugger when it actually hits a debugger statement:
module ::Kernel
undef debugger
def debugger(steps = 1, &block)
require 'ruby-debug'
Debugger.wait_connection = true
message = "\n***** Waiting for debugger *****"
defined?(Rails) ? Rails.logger.info(message) : $stderr.puts(message)
Debugger.start_remote
if block
Debugger.start({}, &block)
else
Debugger.start unless Debugger.started?
Debugger.run_init_script(StringIO.new)
if 0 == steps
Debugger.current_context.stop_frame = 0
else
Debugger.current_context.stop_next = steps
end
end
end
end
--
You received this message because you are subscribed to the Google Groups
"WellRailed" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/wellrailed?hl=en.