Skip to content

Instantly share code, notes, and snippets.

@gjnoonan
Created April 29, 2010 13:01
Show Gist options
  • Save gjnoonan/383560 to your computer and use it in GitHub Desktop.
Save gjnoonan/383560 to your computer and use it in GitHub Desktop.
class Address
include MongoMapper::EmbeddedDocument
key :street
key :town
key :county
key :postcode
end
class EmailAddress
include MongoMapper::EmbeddedDocument
key :name, String
end
class Person
include MongoMapper::Document
key :first_name, String
key :last_name, String
key :home_address, Address
key :work_email_address, EmailAddress
key :home_email_address, EmailAddress
end
class PeriodOfAbscence
include MongoMapper::EmbeddedDocument
key :start_date, Date
key :end_date, Date
key :reason, String
end
class Employee < Person
end
class Parent < Person
key :work_address, Address
many :children
end
class Child < Person
many :parents
key :emergency_contact, Person
key :dob, Date
end
class Company
key :name, String
key :address, Address
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment