Module: MongoModel::Collection::PropertyDefaults

Included in:
EmbeddedDocument
Defined in:
lib/mongomodel/support/collection.rb

Instance Method Summary collapse

Instance Method Details

#property(name, *args, &block) ⇒ Object

:nodoc:



6
7
8
9
10
11
12
13
14
# File 'lib/mongomodel/support/collection.rb', line 6

def property(name, *args, &block) #:nodoc:
  property = super(name, *args, &block)

  if property.type <= Collection
    property.options[:default] ||= lambda { property.type.new }
  end

  property
end