Forum: Ruby on Rails Ruby Debug Not Working

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eric J (Guest)
on 2009-01-18 00:19
(Received via mailing list)
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
Fernando P. (Guest)
on 2009-01-18 15:13
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
Eric J (Guest)
on 2009-01-18 16:21
(Received via mailing list)
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>
Teedub (Guest)
on 2009-01-18 16:28
(Received via mailing list)
I think you need mongrel for debug
try
script/server mongrel
Eric J (Guest)
on 2009-01-18 17:55
(Received via mailing list)
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?
Eric J (Guest)
on 2009-01-18 18:20
(Received via mailing list)
Well it started working, so maybe it was mongrel!

Thanks for your help guys.
James B. (Guest)
on 2009-01-19 01:29
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
Xuan (Guest)
on 2009-01-20 00:13
(Received via mailing list)
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.
Daniel T. G. (Guest)
on 2009-04-07 08:00
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 ...!!!
Vladimir R. (Guest)
on 2009-04-07 09:46
(Received via mailing list)
$ rdebug ./script/server would help
(Have to enter "c" after starting)

On Apr 7, 11:00 am, Daniel T. <rails-mailing-l...@andreas-
This topic is locked and can not be replied to.