Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Plugin for defining an embedded version of a document declaratively

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README
EmbeddableDocument is for declaring that a document can be embedded. Example:

  class Author
    include MongoMapper::Document
    include MongoMapper::EmbeddableDocument
    
    key :name
    key :age, Integer
    key :bio
    
    embeddable_attributes :name, :age
  end

  celine          = Author.find_by_name 'Ferdinand Celine'
  embedded_celine = celine.as_embedded
  
  embedded_celine.name              # => "Ferdinand Celine"
  embedded_celine.respond_to? :bio  # => false
  embedded_celine.original_document # => celine
  embedded_celine.original_id       # => celine.id
  embedded_celine.class             # => Author::Embedded
  
Of course, you can just do:

  Author::Embedded.new :name => "Henry Miller"
Something went wrong with that request. Please try again.