Skip to content

Instantly share code, notes, and snippets.

@jacquescrocker
Forked from anonymous/gist:464736
Created July 5, 2010 22:29
Show Gist options
  • Save jacquescrocker/464765 to your computer and use it in GitHub Desktop.
Save jacquescrocker/464765 to your computer and use it in GitHub Desktop.
def new
client = Client.create!(:name => 'border', :description => 'lala')
content = Content.new(:key => 'help_about', :value => 'hello there')
content.client = client
end
class Client
include Mongoid::Document
field :name
field :description
field :version
embeds_many :contents
end
class Content
include Mongoid::Document
field :key
field :value
embedded_in :client, :inverse_of => :contents
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment