Module: MongoModel::Map::PropertyDefaults

Included in:
EmbeddedDocument
Defined in:
lib/mongomodel/support/map.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/map.rb', line 6

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

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

  property
end