orphaned instance variables?

My friend William Kennedy passed me a tutorial for getting a web app up and running in Sinatra in 2 hours or less.

In the process of working through it, I had some questions and started to look for other tutorials.  I found a great one at tutsplus, and started working through it.

I am working on the second part of the tutorial and found this interesting bit of code:


What’s confusing about it is that the instance variables are initialized outside of the class Note.  In fact, when I first wrote this, I put the get "/" do block inside the Note class. But when I ran it that way, it wouldn’t work.  I had to move it out of the class, and now it works!

I am guessing there is some class within Sinatra that’s taking those variables, but that’s just a guess.  Anyone have any info about this?

I hope to push this to heroku once it’s ready and I’ll share it here if I do.

One thought on “orphaned instance variables?”

  1. PS if you go through this tutorial, note that you’ll have to require “data_mapper”, not require “datamapper” as the tutorial states. Check out the comments on the tutorial as you are going through it if you run into errors.

Leave a Reply

Your email address will not be published. Required fields are marked *