123456789_123456789_123456789_123456789_123456789_

Class: Mongoid::GlobalDiscriminatorKeyAssignment::InvalidFieldHost Private

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
self, ::Mongoid::Document, ::Mongoid::Touchable::InstanceMethods, ::Mongoid::Composable, ActiveModel::Model, ActiveModel::ForbiddenAttributesProtection, ActiveModel::Serializers::JSON, ::Mongoid::Atomic, ::Mongoid::Changeable, ::Mongoid::Clients, ::Mongoid::Clients::Sessions, ::Mongoid::Clients::Options, ::Mongoid::Clients::StorageOptions, ::Mongoid::CollectionConfigurable, ::Mongoid::Attributes, ::Mongoid::Attributes::Readonly, ::Mongoid::Attributes::Processing, ::Mongoid::Attributes::Nested, ::Mongoid::Evolvable, ::Mongoid::Fields, ::Mongoid::Indexable, ::Mongoid::Inspectable, ::Mongoid::Matchable, ::Mongoid::Persistable, ::Mongoid::Persistable::Unsettable, ::Mongoid::Persistable::Upsertable, ::Mongoid::Persistable::Updatable, ::Mongoid::Persistable::Settable, ::Mongoid::Persistable::Savable, ::Mongoid::Persistable::Renamable, ::Mongoid::Persistable::Pushable, ::Mongoid::Persistable::Pullable, ::Mongoid::Positional, ::Mongoid::Persistable::Poppable, ::Mongoid::Persistable::Multipliable, ::Mongoid::Persistable::Minable, ::Mongoid::Persistable::Maxable, ::Mongoid::Persistable::Logical, ::Mongoid::Persistable::Incrementable, ::Mongoid::Persistable::Destroyable, ::Mongoid::Persistable::Deletable, ::Mongoid::Persistable::Creatable, ::Mongoid::Association, ::Mongoid::Association::Reflections, ::Mongoid::Association::Macros, ::Mongoid::Association::Builders, ::Mongoid::Association::Depending, ::Mongoid::Association::Accessors, ::Mongoid::Association::Referenced::Syncable, ::Mongoid::Association::Referenced::CounterCache, ::Mongoid::Association::Referenced::AutoSave, ::Mongoid::Association::Embedded::Cyclic, ::Mongoid::Reloadable, ::Mongoid::Scopable, ::Mongoid::SearchIndexable, ::Mongoid::Selectable, ::Mongoid::Serializable, ::Mongoid::Shardable, ::Mongoid::Stateful, ::Mongoid::Cacheable, ::Mongoid::Threaded::Lifecycle, ::Mongoid::Traversable, ::Mongoid::Validatable::Macros, ::Mongoid::Validatable, ::Mongoid::Interceptable, ::Mongoid::Copyable, ::Mongoid::Equality, ::Mongoid::Encryptable
Inherits: Object
Defined in: lib/mongoid.rb

Overview

This class is used for obtaining the method definition location for ::Mongoid methods.

Constant Summary

::Mongoid::Interceptable - Included

CALLBACKS

::Mongoid::Association::Depending - Included

STRATEGIES

::Mongoid::Association - Included

MACRO_MAPPING

::Mongoid::Persistable - Included

LIST_OPERATIONS

::Mongoid::Fields - Included

Boolean, IDS, INVALID_BSON_CLASSES, StringifiedSymbol, TYPE_MAPPINGS

::Mongoid::Clients - Included

CREATE_LOCK

::Mongoid::Changeable - Included

ATTRIBUTE_UNCHANGED

::Mongoid::Atomic - Included

UPDATES

::Mongoid::Composable - Included

MODULES, RESERVED_METHOD_NAMES

::Mongoid::Document - Included

ILLEGAL_KEY

Instance Attribute Summary

::Mongoid::Document - Included

#__selected_fields,
#frozen?

Checks if the document is frozen.

#internal_state=

Sets the internal state of this document.

#new_record,
#internal_state

Constructs a hash representing the internal state of this object, suitable for passing to #internal_state=.

::Mongoid::Touchable::InstanceMethods - Included

#_touchable_parent?

Indicates whether the parent exists and is touchable.

#touch_callbacks_suppressed?

Queries whether touch callbacks are being suppressed for the class that includes this module.

::Mongoid::Composable - Included

::Mongoid::Changeable - Included

#changed

Get the changed attributes for the document.

#changed?

Has the document changed?

#children_changed?

Have any children (embedded documents) of this document changed?

::Mongoid::Clients::Options - Included

#persistence_context

Get the document’s current persistence context.

#persistence_context?

Returns whether a persistence context is set for the document or the document’s class.

::Mongoid::Clients::StorageOptions - Included

#remembered_storage_options

Remembers the storage options that were active when the current object was instantiated/created.

::Mongoid::Attributes - Included

::Mongoid::Fields - Included

#using_object_ids?

Is the document using object ids?

::Mongoid::Persistable - Included

#executing_atomically?

Are we executing an atomically block on the current document?

::Mongoid::Association - Included

#_association, #aliased_associations, #aliased_associations?, #cyclic, #cyclic?, #dependents, #dependents?, #dependents_owner, #dependents_owner?,
#embedded?

Determine if the document itself is embedded in another document via the proper channels.

#embedded_many?

Determine if the document is part of an embeds_many association.

#embedded_one?

Determine if the document is part of an embeds_one association.

#embedded_relations, #embedded_relations?,
#referenced_many?

Determine if the document is part of an references_many association.

#referenced_one?

Determine if the document is part of an references_one association.

#relations, #relations?, #stored_as_associations, #stored_as_associations?

::Mongoid::Association::Accessors - Included

#without_autobuild?

Is the current code executing without autobuild functionality?

::Mongoid::Association::Referenced::AutoSave - Included

#autosaved?

Used to prevent infinite loops in associated autosaves.

::Mongoid::Stateful - Included

#_destroy
#destroyed=,
#destroyed?

Returns true if the Document has been succesfully destroyed, and false if it hasn’t.

#flagged_for_destroy=,
#flagged_for_destroy?

Returns whether or not the document has been flagged for deletion, but not destroyed yet.

#marked_for_destruction?
#new_record=

Sets whether the document has been persisted to the database.

#new_record?

Returns true if the document has not been persisted to the database, false if it has.

#persisted?

Checks if the document has been saved to the database.

#previously_new_record=,
#previously_new_record?

Returns true if this document was just created – that is, prior to the last save, the object didn’t exist in the database and new_record? would have returned true.

#previously_persisted?

Checks if the document was previously saved to the database but now it has been deleted.

#pushable?

Determine if the document can be pushed.

#readonly?

Is the document readonly?

#settable?

Determine if the document can be set.

#updateable?

Is the document updateable?

::Mongoid::Threaded::Lifecycle - Included

#_assigning

Begin the assignment of attributes.

#_assigning?

Is the current thread in assigning mode?

#_binding

Execute a block in binding mode.

#_binding?

Is the current thread in binding mode?

#_building

Execute a block in building mode.

#_building?

Is the current thread in building mode?

#_creating?

Is the current thread in creating mode?

#_loading

Execute a block in loading mode.

#_loading?

Is the current thread in loading mode?

::Mongoid::Traversable - Included

#_parent

Retrieves the parent document of this document.

#_parent=

Sets the parent document of this document.

#_root

Return the root document in the object graph.

#_root?

Is this document the root document of the hierarchy?

#hereditary?

Determines if the document is a subclass of another document.

::Mongoid::Validatable - Included

#validated?

Used to prevent infinite loops in associated validations.

#validating_with_query?

Are we currently performing a validation that has a query?

::Mongoid::Interceptable - Included

#pending_callbacks

Returns the stored callbacks to be executed later.

#pending_callbacks=

Stores callbacks to be executed later.

#before_callback_halted?

We need to hook into this for autosave, since we don’t want it firing if the before callbacks were halted.

Instance Method Summary

::Mongoid::Document - Included

#_handle_callbacks_after_instantiation

Handles the setup and execution of callbacks, if callbacks are to be executed; otherwise, adds the appropriate callbacks to the pending callbacks list.

#as_document

Return a hash of the entire document hierarchy from this document and below.

#becomes

Returns an instance of the specified class with the attributes, errors, and embedded documents of the current document.

#freeze

Freezes the internal attributes of the document.

#hash

Delegates to identity in order to allow two records of the same identity to work with something like:

#identity

A Document’s is identified absolutely by its class and database id:

#initialize

Instantiate a new Document, setting the Document’s attributes if given.

#model_name

Return the model name of the document.

#to_key

Return the key value for the document.

#add_attributes_for_relation

Adds the attributes for the given relation to the document’s attributes.

#as_attributes

Returns a hash of the attributes.

#construct_document

Does the construction of a document.

#logger

Returns the logger.

#mark_persisted_state_for_embedded_documents

Marks all embedded documents with the given “new_record” state.

#model_key

Get the name of the model used in caching.

#mongoid_document_check!

Checks that the given argument is an instance of ‘Mongoid::Document`.

#prepare_to_process_attributes

Initializes the object state prior to attribute processing; this is called only from #construct_document.

#resolve_post_construction_callbacks

Either executes or enqueues the post-construction callbacks.

#update_discriminator

Updates the value of the discriminator_key for this object, setting its previous value to ‘key_was`.

::Mongoid::Touchable::InstanceMethods - Included

#_clear_touch_updates

Clears changes for the model caused by touch operation.

#_gather_touch_updates

Recursively sets touchable fields on the current document and each of its parents, including the root node.

#_run_touch_callbacks_from_root

Recursively runs :touch callbacks for the document and its parents, beginning with the root document and cascading through each successive child document.

#suppress_touch_callbacks

Suppresses the invocation of touch callbacks, for the class that includes this module, for the duration of the block.

#touch

Touch the document, in effect updating its updated_at timestamp and optionally the provided field to the current time.

#_extract_touches_from_atomic_sets

Extract and remove the atomic updates for the touch operation(s) from the currently enqueued atomic $set operations.

::Mongoid::Atomic - Included

#_updates
#add_atomic_pull

Add the document as an atomic pull.

#add_atomic_unset

Add an atomic unset for the document.

#atomic_array_add_to_sets

For array fields these are the unique adds that need to happen.

#atomic_array_pulls

For array fields these are the pulls that need to happen.

#atomic_array_pushes

For array fields these are the pushes that need to happen.

#atomic_attribute_name

Returns path of the attribute for modification.

#atomic_delete_modifier

Get the removal modifier for the document.

#atomic_insert_modifier

Get the insertion modifier for the document.

#atomic_path

Return the path to this Document in JSON notation, used for atomic updates via $set in MongoDB.

#atomic_paths

Get the atomic paths utility for this document.

#atomic_position

Returns the positional operator of this document for modification.

#atomic_pulls

Get all the attributes that need to be pulled.

#atomic_pushes

Get all the push attributes that need to occur.

#atomic_sets

Get all the attributes that need to be set.

#atomic_unsets

Get all the attributes that need to be unset.

#atomic_updates

Get all the atomic updates that need to happen for the current Document.

#delayed_atomic_pulls

Get a hash of atomic pulls that are pending.

#delayed_atomic_sets

Get all the atomic sets that have had their saves delayed.

#delayed_atomic_unsets

Get the delayed atomic unsets.

#flag_as_destroyed

Flag the document as destroyed and return the atomic path.

#flagged_destroys

Get the flagged destroys.

#process_flagged_destroys

Process all the pending flagged destroys from nested attributes.

#generate_atomic_updates

Generates the atomic updates in the correct order.

#reset_atomic_updates!

Clears all pending atomic updates.

::Mongoid::Changeable - Included

#attribute_before_last_save

Returns the original value of an attribute before the last save.

#attribute_changed?

Determine if a specific attribute has changed.

#attribute_changed_from_default?

Get whether or not the field has a different value from the default.

#attribute_previously_was

Get the previous attribute value that was changed before the document was saved.

#attribute_was

Get the previous value for the attribute.

#attribute_will_change!

Flag an attribute as going to change.

#changed_attributes

Get the attribute changes.

#changes

Get all the changes for the document.

#move_changes

Call this method after save, so the changes can be properly switched.

#post_persist

Things that need to execute after a document has been persisted.

#previous_changes

Get the previous changes on the document.

#remove_change

Remove a change from the dirty attributes hash.

#reset_attribute!

::Set the attribute back to its old value.

#reset_attribute_to_default!, #reset_attributes_before_type_cast,
#saved_change_to_attribute

Returns the change to an attribute during the last save.

#saved_change_to_attribute?

Returns whether this attribute changed during the last save.

#setters

Gets all the new values for each of the changed fields, to be passed to a MongoDB $set modifier.

#will_save_change_to_attribute?

Returns whether this attribute change the next time we save.

#attribute_change

Get the old and new value for the provided attribute.

#attributes_before_last_save, #changes_before_last_save,
#previous_attributes

Get attributes of the document before the document was saved.

::Mongoid::Clients::Sessions - Included

#ensure_client_compatibility!

If at least one session is active, this ensures that the current model’s client is compatible with one of them.

::Mongoid::Clients::Options - Included

#collection

Get the collection for the document’s current persistence context.

#collection_name

Get the collection name for the document’s current persistence context.

#mongo_client

Get the database client for the document’s current persistence context.

#with

Change the persistence context for this object during the block.

#clear_persistence_context, #set_persistence_context

::Mongoid::Clients::StorageOptions - Included

#remember_storage_options!

Saves the storage options from the current persistence context.

#storage_options

The storage options that apply to this record, consisting of both the class-level declared storage options (e.g.

::Mongoid::Attributes - Included

#[]
#[]=
#assign_attributes

Allows you to set all the attributes for a particular mass-assignment security role by passing in a hash of attributes with keys matching the attribute names (which again matches the column names) and the role name using the :as option.

#attribute_missing?

Determine if the attribute is missing from the document, due to loading it from the database with missing fields.

#attribute_present?

Determine if an attribute is present.

#attributes,
#attributes=
#attributes_before_type_cast

Get the attributes that have not been cast.

#has_attribute?

Does the document have the provided attribute?

#has_attribute_before_type_cast?

Does the document have the provided attribute before it was assigned and type cast?

#process_raw_attribute

Process the raw attribute values just read from the documents attributes.

#read_attribute

Read a value from the document attributes.

#read_attribute_before_type_cast

Read a value from the attributes before type cast.

#remove_attribute

Remove a value from the Document attributes.

#typed_attributes

Return type-casted attributes.

#write_attribute

Write a single attribute to the document attribute hash.

#write_attributes

Writes the supplied attributes hash to the document.

#hash_dot_syntax?

Does the string contain dot syntax for accessing hashes?

#lookup_attribute_presence, #read_raw_attribute,
#typed_value_for

Return the typecasted value for a field.

::Mongoid::Attributes::Readonly - Included

#attribute_writable?

Are we able to write the attribute with the provided name?

#_loaded?, #as_writable_attribute!, #projected_field?

::Mongoid::Attributes::Processing - Included

#process_attributes

Process the provided attributes casting them to their proper values if a field exists for them on the document.

#pending_attribute?

If the key provided is the name of an association or a nested attribute, we need to wait until all other attributes are set before processing these.

#pending_nested

Get all the pending nested attributes that need to be set.

#pending_relations

Get all the pending associations that need to be set.

#process_attribute

If the attribute is dynamic, add a field for it with a type of object and then either way set the value.

#process_nested

Process all the pending nested attributes that needed to wait until ids were set to fire off.

#process_pending

Process all the pending items, then clear them out.

#process_relations

Process all the pending associations that needed to wait until ids were set to fire off.

#set_pending_nested

::Set value of the pending nested attribute.

#set_pending_relation

::Set value of the pending relation.

::Mongoid::Evolvable - Included

#__evolve_object_id__

Evolve the document into an object id.

::Mongoid::Fields - Included

#apply_default

Applies a single default value for the given name.

#apply_defaults

Apply all the defaults at once.

#apply_post_processed_defaults

Apply all default values to the document which are procs.

#apply_pre_processed_defaults

Apply all default values to the document which are not procs.

#attribute_names

Returns an array of names for the attributes available on this object.

#database_field_name

Get the name of the provided field as it is stored in the database.

#dot_dollar_field?

Does this field start with a dollar sign ($) or contain a dot/period (.)?

#lazy_settable?

Is the provided field a lazy evaluation?

#validate_writable_field_name!

Validate whether or not the field starts with a dollar sign ($) or contains a dot/period (.).

::Mongoid::Inspectable - Included

#inspect

Returns the class name plus its attributes.

#pretty_print

This pretty prints the same information as the inspect method.

#inspect_dynamic_fields

Get an array of inspected dynamic fields for the document.

#inspect_fields

Get an array of inspected fields for the document.

::Mongoid::Matchable - Included

#_matches?

Determines if this document has the attributes to match the supplied MongoDB selector.

::Mongoid::Persistable - Included

#atomically

Execute operations atomically (in a single database call) for everything that would happen inside the block.

#fail_due_to_callback!

Raise an error if a callback failed.

#fail_due_to_validation!

Raise an error if validation failed.

#_mongoid_atomic_context_changed_fields

Return the current atomic context’s changed fields.

#_mongoid_pop_atomic_context

Pop an atomic context off the stack.

#_mongoid_push_atomic_context

Push a new atomic context onto the stack.

#_mongoid_remove_atomic_context_changes

Remove the dirty changes for all fields changed in the current atomic context.

#_mongoid_reset_atomic_context_changes!

Reset the attributes for all fields changed in the current atomic context.

#persist_atomic_operations

Persist the atomic operations.

#persist_or_delay_atomic_operation

If we are in an atomically block, add the operations to the delayed group, otherwise persist immediately.

#post_process_persist

Post process the persistence operation.

#prepare_atomic_operation

Prepare an atomic persistence operation.

#process_atomic_operations

Process the atomic operations - this handles the common behavior of iterating through each op, getting the aliased field name, and removing appropriate dirty changes.

::Mongoid::Persistable::Unsettable - Included

#unset

Perform an $unset operation on the provided fields and in the values in the document in memory.

::Mongoid::Persistable::Upsertable - Included

#upsert

Perform an upsert of the document.

#prepare_upsert

Prepare the upsert for execution.

::Mongoid::Persistable::Updatable - Included

#update

Update the document attributes in the database.

#update!

Update the document attributes in the database and raise an error if validation failed.

#update_attribute

Update a single attribute and persist the entire document.

#update_attributes
#update_attributes!
#enforce_immutability_of_id_field!

Checks to see if the _id field has been modified.

#init_atomic_updates

Initialize the atomic updates.

#prepare_update

Prepare the update for execution.

#process_touch_option

If there is a touch option and it is false, this method will call the timeless method so that the updated_at attribute is not updated.

#run_all_callbacks_for_update

Consolidates all the callback invocations into a single place, to avoid cluttering the logic in #prepare_update.

#update_document

Update the document in the database.

::Mongoid::Persistable::Settable - Included

#set

Perform a $set operation on the provided field/value pairs and set the values in the document in memory.

::Mongoid::Persistable::Savable - Included

#save

Save the document - will perform an insert if the document is new, and update if not.

#save!

Save the document - will perform an insert if the document is new, and update if not.

::Mongoid::Persistable::Renamable - Included

#rename

Rename fields from one value to another via $rename.

::Mongoid::Persistable::Pushable - Included

#add_to_set

Add the single values to the arrays only if the value does not already exist in the array.

#push

Push a single value or multiple values onto arrays.

::Mongoid::Persistable::Pullable - Included

#pull

Pull single values from the provided arrays.

#pull_all

Pull multiple values from the provided array fields.

::Mongoid::Positional - Included

#positionally

Takes the provided selector and atomic operations and replaces the indexes of the embedded documents with the positional operator when needed.

#process_operations, #process_updates, #replace_index

::Mongoid::Persistable::Poppable - Included

#pop

Pop or shift items from arrays using the $pop operator.

::Mongoid::Persistable::Multipliable - Included

#mul

Multiply the provided fields by the corresponding values.

::Mongoid::Persistable::Minable - Included

#clamp_upper_bound
#set_min

::Set the given field or fields to the smaller of either it’s current value, or a given value.

::Mongoid::Persistable::Maxable - Included

#clamp_lower_bound
#set_max

::Set the given field or fields to the larger of either it’s current value, or a given value.

::Mongoid::Persistable::Logical - Included

#bit

Performs an atomic $bit operation on the field with the provided hash of bitwise ops to execute in order.

::Mongoid::Persistable::Incrementable - Included

#inc

Increment the provided fields by the corresponding values.

::Mongoid::Persistable::Destroyable - Included

#destroy

Remove the document from the database with callbacks.

#destroy!

Remove the document from the database with callbacks.

::Mongoid::Persistable::Deletable - Included

#delete

Remove the document from the database.

#remove
#atomic_deletes

Get the atomic deletes for the operation.

#delete_as_embedded

Delete the embedded document.

#delete_as_root

Delete the root document.

#notifying_parent?

Are we needing to notify the parent document of the deletion.

#prepare_delete

Prepare the delete operation.

::Mongoid::Persistable::Creatable - Included

#insert

Insert a new document into the database.

#atomic_inserts

Get the atomic insert for embedded documents, either a push or set.

#insert_as_embedded

Insert the embedded document.

#insert_as_root

Insert the root document.

#post_process_insert

Post process an insert, which sets the new record attribute to false and flags all the children as persisted.

#prepare_insert

Prepare the insert for execution.

::Mongoid::Association - Included

#association_name

Get the association name for this document.

#reload_relations

Convenience method for iterating through the loaded associations and reloading them.

::Mongoid::Association::Reflections - Included

#reflect_on_all_association

Returns all association metadata for the supplied macros.

#reflect_on_association

Returns the association metadata for the supplied name.

::Mongoid::Association::Macros - Included

#associations

This is convenience for libraries still on the old API.

::Mongoid::Association::Builders - Included

#parse_args

Parse out the attributes and the options from the args passed to a build_ or create_ methods.

::Mongoid::Association::Depending - Included

::Mongoid::Association::Accessors - Included

#__build__

Builds the related document and creates the association unless the document is nil, then sets the association on this document.

#create_relation

Create an association from an object and association metadata.

#reset_relation_criteria

Resets the criteria inside the association proxy.

#set_relation

::Set the supplied association to an instance variable on the class with the provided name.

#_mongoid_filter_selected_fields

Returns a subset of __selected_fields attribute applicable to the (embedded) association with the given key, or nil if no projection is to be performed.

#get_relation

Get the association.

#needs_no_database_query?,
#parse_args

Parse out the attributes and the options from the args passed to a build_ or create_ methods.

#without_autobuild

Yield to the block with autobuild functionality turned off.

::Mongoid::Association::Referenced::Syncable - Included

#_syncable?

Is the document able to be synced on the inverse side? This is only if the key has changed and the association bindings have not been run.

#_synced

Get the synced foreign keys.

#_synced?

Has the document been synced for the foreign key?

#remove_inverse_keys

Update the inverse keys on destroy.

#update_inverse_keys

Update the inverse keys for the association.

::Mongoid::Association::Referenced::CounterCache - Included

#reset_counters

Reset the given counter using the .count() query from the db.

::Mongoid::Association::Referenced::AutoSave - Included

#__autosaving__

Begin the associated autosave.

#changed_for_autosave?

Check if there is changes for auto-saving.

::Mongoid::Reloadable - Included

#reload

Reloads the Document attributes from the database.

#_reload

Reload the document, determining if it’s embedded or not and what behavior to use.

#check_for_deleted_document!

Checks to see if the given attributes argument indicates that the object has been deleted.

#reload_embedded_document

Reload the embedded document.

#reload_root_document

Reload the root document.

#reset_object!

Resets the current object using the given attributes.

::Mongoid::Scopable - Included

#apply_default_scoping

Apply the default scoping to the attributes of the document, as long as they are not complex queries.

::Mongoid::Selectable - Included

#atomic_selector

Get the atomic selector for the document.

#embedded_atomic_selector

Get the atomic selector for an embedded document.

#root_atomic_selector_in_db

Get the atomic selector that would match the existing version of the root document.

::Mongoid::Serializable - Included

#serializable_hash

Gets the document as a serializable hash, used by ActiveModel’s JSON serializer.

#field_names

Get the names of all fields that will be serialized.

#relation_names

Since the inclusions can be a hash, symbol, or array of symbols, this is provided as a convenience to parse out the names.

#relation_options

Since the inclusions can be a hash, symbol, or array of symbols, this is provided as a convenience to parse out the options.

#serialize_attribute

Serialize a single attribute.

#serialize_relations

For each of the provided include options, get the association needed and provide it in the hash.

::Mongoid::Shardable - Included

#shard_key_field_value

Returns the value for the named shard key.

#shard_key_fields

Get the shard key fields.

#shard_key_selector

Returns the selector that would match the defined shard keys.

#shard_key_selector_in_db

Returns the selector that would match the existing version of this document in the database.

::Mongoid::Stateful - Included

#readonly!

Flags the document as readonly.

#reset_readonly

::Mongoid::Cacheable - Included

#cache_key

Print out the cache key.

::Mongoid::Traversable - Included

#_children

Get all child Documents to this Document.

#_descendants

Get all descendant Documents of this Document recursively.

#_reset_memoized_descendants!

Resets the memoized descendants on the object.

#collect_children

Collect all the children of this document.

#collect_descendants

Collect all the descendants of this document.

#flag_descendants_persisted

Marks all descendants as being persisted.

#parentize

Sets up a child/parent association.

#remove_child

Remove a child document from this parent.

#reset_persisted_descendants

After descendants are persisted we can call this to move all their changes and flag them as persisted in one call.

::Mongoid::Validatable::Macros - Included

#validates_associated

Validates whether or not an association is valid or not.

#validates_format_of

Validates the format of a field.

#validates_length_of

Validates the length of a field.

#validates_presence_of

Validates whether or not a field is present - meaning nil or empty.

#validates_uniqueness_of

Validates whether or not a field is unique against the documents in the database.

::Mongoid::Validatable - Included

#begin_validate

Begin the associated validation.

#exit_validate

Exit the associated validation.

#performing_validations?

Given the provided options, are we performing validations?

#read_attribute_for_validation

Overrides the default ActiveModel behavior since we need to handle validations of associations slightly different than just calling the getter.

#valid?

Determine if the document is valid.

#validating

Perform a validation within the associated block.

::Mongoid::Interceptable - Included

#_mongoid_run_child_after_callbacks

Execute the after callbacks.

#_mongoid_run_child_before_callbacks

Execute the before callbacks of given kind for embedded documents.

#_mongoid_run_child_callbacks

Run the callbacks for embedded documents.

#_mongoid_run_child_callbacks_with_around

Execute the callbacks of given kind for embedded documents including around callbacks.

#_mongoid_run_child_callbacks_without_around

Execute the callbacks of given kind for embedded documents without around callbacks.

#callback_executable?

Is the provided type of callback executable by this document?

#in_callback_state?

Is the document currently in a state that could potentially require callbacks to be executed?

#run_after_callbacks

Run only the after callbacks for the specific event.

#run_before_callbacks

Run only the before callbacks for the specific event.

#run_callbacks

Run the callbacks for the document.

#run_pending_callbacks

Run the pending callbacks.

#cascadable_child?

Determine if the child should fire the callback.

#cascadable_children

Get all the child embedded documents that are flagged as cascadable.

#child_callback_type

Get the name of the callback that the child should fire.

#compile_callbacks

Compile the callback chain.

#halted_callback_hook

We need to hook into this for autosave, since we don’t want it firing if the before callbacks were halted.

#run_targeted_callbacks

Run only the callbacks for the target location (before, after, around) and kind (save, update, create).

::Mongoid::Copyable - Included

#clone

Clone or dup the current Document.

#dup

Alias for Copyable#clone.

#clone_document

Clone the document attributes.

#process_localized_attributes

When cloning, if the document has localized fields we need to ensure they are properly processed in the clone.

::Mongoid::Equality - Included

#<=>

Default comparison is via the string version of the id.

#==

Performs equality checking on the document ids.

#eql?

Delegates to ==.