Skip to content

Instantly share code, notes, and snippets.

@dce
Created April 9, 2010 12:59
Show Gist options
  • Save dce/361132 to your computer and use it in GitHub Desktop.
Save dce/361132 to your computer and use it in GitHub Desktop.
require "rubygems"
require "mongo_mapper"
MongoMapper.database = 'test_db'
class Person
include MongoMapper::Document
key :first_name, String
key :last_name, String
key :middle_initial, String
def name
"#{first_name} #{middle_initial}. #{last_name}"
end
end
# person = Person.create({
# :first_name => "David",
# :last_name => "Eisinger"
# })
#
# person.save
person = Person.first
p person.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment