Module: Mongomatic::TypedFields

Included in:
Base
Defined in:
lib/mongomatic/typed_fields.rb

Overview

Typed Fields

Explicitly specify the field types in your document. This is completely optional. You can also set whether or not we should try to automatically cast a type to the desired type.

Examples

typed_field "age",                :type => :fixnum,  :cast => true
typed_field "manufacturer.name",  :type => :string,  :cast => false

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: InvalidType

Constant Summary collapse

KNOWN_TYPES =
[:string, :float, :fixnum, :array, :hash, :bool,
:time, :regex, :symbol, :object_id]

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



15
16
17
18
# File 'lib/mongomatic/typed_fields.rb', line 15

def self.included(base)
  base.send(:extend,  ClassMethods)
  base.send(:include, InstanceMethods)
end