views:

100

answers:

2

I know of the ruby gem "ruby-debug" that allows you to place a debugger call inside your code. Using it, it's possible to have breakpoints in your code.

I used script/console a bit for some tests, and I would like to know if I can call it from my code.

Thanks !

EDIT:

here is some sample ruby code


require "ruby-debug"

[1,2,3,4,5].each do |item|
   if item == 2
      # this starts a irb-like shell from which you can step through your code
      debugger 
   end
end

I would like to achieve the same thing, but using the rails console.

A: 

Whilst debugging you can type irb to open the console. Other than that, I'm not sure I understand what you mean...

tomafro
A: 

I think the only way is by adding debugger statements in your code.

Geo