Created
August 6, 2012 19:25
-
-
Save k2052/3277777 to your computer and use it in GitHub Desktop.
Test Parent Child MongoMapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mongo_mapper' | |
MongoMapper.connection = Mongo::Connection.new('localhost') | |
MongoMapper.database = 'playground' | |
class Parent | |
include MongoMapper::Document | |
key :name, String | |
many :children | |
end | |
class Child | |
include MongoMapper::EmbeddedDocument | |
belongs_to :parent | |
def parent=(parent) | |
super(parent) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment