I have a quick question about breakpoints. I am testing a class method
inside a model in development mode and when I get to the breakpoint, I
can't seem to inspect any of the local variables inside the method.
Here is what the code looks like:
@user = User.new(params[:user])
user = User.new(params[:user])
# do stuff
# do other stuff
I can inspect the instance variable just fine, but
if I try to inspect the 'user' local variable or params or options I
get the following exception:
ameError: undefined local variable or method `user' for User:Class
from (druby://localhost:42531) (irb):1:in `breakpoint'
I noticed the same thing happens in unit tests as well. Any ideas?
I am using rails 1.1.6 and ruby 1.8.5
I worked around this by upgrading to using ruby-debug within my rails
app. It's quite nice for someone who likes gdb! Still wondering why
breakpoint didn't happen to work otherwise though.
I am experiencing the same issue as you, I can see instance but not
local variables. However, it only acts this way on two different
machines. On one machine with Rails installed via the Gem install I CAN
see local variables but on another machine with a Rails install done
via the SysAdmin(s) I can NOT see local variables (one could almost
imagine the situation being reversed - a custom install of Rails
*would* have local variable visibility because it might be the version
you ended up using - ruby-debug). But this isnt the case.
Did you make any further progress on this w/o having to resort to
breakpoint(er) relies on Binding.of_caller which was broken by Ruby
1.8.5. Without this method, there's no (easy, fast) way to access the
local variables of the caller.