I have a simple mongodb collection which stores tweets directly from the twitter api (via a ruby script).
I'm now building a simple Sinatra app to display some of these tweets.
So far, I've managed to get a simple view to display some of the tweet data by building a simple Tweet model and assigning variables to some of the fields stored in my tweet collection.
e.g.
class Tweet
include Mongoid::Document
field :text, :type => String
field :id_str, :type => String
field :user, :type => String
end
Do I need to create explicit variables for each field in my mongo collection or is there a smarter way of automatically assigning variable names based on the field name stored in mongo?
Thanks,
Ed