views:

112

answers:

1

I was following a video tutorial by Adam Keys about how to make a URL shortener app in Sinatra. The code that is giving me problems is located here http://pastie.org/958644

So when I ran it I got this error:

shortener.rb:12: syntax error, unexpected $undefined, expecting $end @@ home

I typed it exactly as Adam said but this keeps happening. What could the issue be?

By the way, I am running ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32] on Windows Vista.

Thanks, Adam

A: 

I found the answer on IRC #sinatra channel. The problem was two fold.

  1. I had a space after @@ home. Once I got rid of that space I got a new error.

  2. The new error was:

shortener.rb:8:in : undefined method `use_in_file_templates!' for main:O bject (NoMethodError)

The reason this was happening because the video tutorial I was watching was dated and Sinatra is currently at version 1.0. So the updates for Sinatra are located at:

http://github.com/sinatra/sinatra/blob/1.0/CHANGES#L101

Ultimately I just had to replace the use_in_file_templates! method with the enable :inline_templates method.

J3M 7OR3