Skip to content

@jnunemaker /gist:911a2b460e50790f7da4 secret
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
require 'pp'
require 'rubygems'
require 'mongo_mapper'
MongoMapper.connection = Mongo::Connection.new
MongoMapper.database = 'testing'
class Address
include MongoMapper::EmbeddedDocument
key :address, String
end
class Person
include MongoMapper::Document
many :addresses
end
Person.collection.remove
person = Person.new
person.addresses << Address.new(:address => 'Home sweet home')
person.save
pp person
pp person.addresses
person.reload
pp person
pp person.addresses
pp Person.collection.find.to_a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.