Ruby Debug Not Working


#1

I installed ruby-debug using this command:
sudo gem install ruby-debug -y

and then added the line to config/environments/development.rb:
require “ruby-debug”

I restarted webrick and put ‘debugger’ in my code and tried to access
the page with the debugger command, but it didn’t do anything. I’ve
tried several times and restarted webrick, to no avail.

rails 2.1.1
ruby1.8.6
ruby-debug-0.10.3

Eric


#2

Eric J wrote:

I installed ruby-debug using this command:
sudo gem install ruby-debug -y

and then added the line to config/environments/development.rb:
require “ruby-debug”

I restarted webrick and put ‘debugger’ in my code and tried to access
the page with the debugger command, but it didn’t do anything. I’ve
tried several times and restarted webrick, to no avail.

rails 2.1.1
ruby1.8.6
ruby-debug-0.10.3

Eric

Where did you put the require statement and where did you put the
debugger method for instance?


Video training screencasts at http://www.digiprof.fr


#3

I put require “ruby-debug” at the top of config/environments/
development.rb. I just tried moving it to the bottom of the file and
that didn’t seem to help either.

I put the command ‘debugger’ at the start of one of my controller
methods, so it should hit the controller and then call debugger.

On Jan 18, 7:13 am, Fernando P. removed_email_address@domain.invalid


#4

I think you need mongrel for debug
try
script/server mongrel


#5

Well it started working, so maybe it was mongrel!

Thanks for your help guys.


#6

I installed mongrel and tried it, but no debugging luck. I tried
adding Debugger.start after the ‘require “ruby-debug”’.

Is there a debug flag that you need to add to the start up command?


#7

Eric J wrote:

I installed mongrel and tried it, but no debugging luck. I tried
adding Debugger.start after the ‘require “ruby-debug”’.

Is there a debug flag that you need to add to the start up command?

script/server --debugger


#8

You can debug with webrick as well: as James B. stated, you must
add --debugger when you run the webrick server.
Also you don’t actually need to add the require statement neither
Debugger.start if you are using rails 2.x . ‘debug’ keywords will also
be ignored if you aren’t running server with ‘–debugger’, though it
can be a danger in rails 1.x apps; ‘debug’ statements will throw an
error unless ’ require “ruby-debug” ’ is added… and even in that case
the server, at least webrick, will stop on the debug breakpoint even
if you run a production server.


#9

$ rdebug ./script/server would help
(Have to enter “c” after starting)

On Apr 7, 11:00 am, Daniel T. <rails-mailing-l…@andreas-


#10

James B. wrote:

Eric J wrote:

I installed mongrel and tried it, but no debugging luck. I tried
adding Debugger.start after the ‘require “ruby-debug”’.

Is there a debug flag that you need to add to the start up command?

script/server --debugger

This is the command correct …!!!