Undefined local variable or method ` ‘

Ever had this little nugget of information? Lets play spot the difference…

Example 1
def my_method(args) # :nodoc:

Example 2
def my_method(args) # :nodoc:

You will notice that there is no apparent difference, which is why I couldn’t work out why one line of code ran, and one caused an error. Anyway, to cut a long story short, I found a unicode character on the line that wasn’t working – and that unicode character didn’t have a corresponding variable or method!

So, Chris’ Thursday Tip is to turn on invisible characters in TextMate (View -> Show Invisibles ⌥⌘I).

Advertisements

Running remote rdebug in client-server mode

I’m still trying to get rdebug to debug my script/server on a remote machine from Textmate and still no luck.  However, I had another play with rdebug and have finally managed to get the client-server mode working. I never managed to find any blog posts that worked for me, so hopefully this will work for you!

On the server (from your Rails application root directory)
rdebug -sw ./script/server

On your local machine
rdebug -c -hIP.ADDRESS.OF.SERVER

Just as a reference I’m running ruby-debug 0.10.1 as a gem on OS X 10.5.4.