Class: Mongoid::Fields::Internal::Array
- Includes:
- Serializable
- Defined in:
- lib/mongoid/fields/internal/array.rb
Overview
Defines the behaviour for array fields.
Instance Attribute Summary
Attributes included from Serializable
#default_val, #label, #localize, #name, #options
Instance Method Summary collapse
-
#add_atomic_changes(document, name, key, mods, new, old) ⇒ Object
Adds the atomic changes for this type of resizable field.
-
#resizable? ⇒ true
Array fields are resizable.
-
#serialize(object) ⇒ Array
Serialize the object from the type defined in the model to a MongoDB compatible object to store.
Methods included from Serializable
#constraint, #deserialize, #eval_default, #foreign_key?, #localized?, #metadata, #object_id_field?, #selection, #type, #versioned?
Instance Method Details
#add_atomic_changes(document, name, key, mods, new, old) ⇒ Object
Adds the atomic changes for this type of resizable field.
23 24 25 |
# File 'lib/mongoid/fields/internal/array.rb', line 23 def add_atomic_changes(document, name, key, mods, new, old) mods[key] = new end |
#resizable? ⇒ true
Array fields are resizable.
35 |
# File 'lib/mongoid/fields/internal/array.rb', line 35 def resizable?; true; end |
#serialize(object) ⇒ Array
Serialize the object from the type defined in the model to a MongoDB compatible object to store.
48 49 50 |
# File 'lib/mongoid/fields/internal/array.rb', line 48 def serialize(object) raise_or_return(object) end |