Module: Mongoid::Composable
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::ForbiddenAttributesProtection, ActiveModel::Model, ActiveModel::Serializers::JSON, Inspectable, Association, Atomic, Attributes, Cacheable, Changeable, Clients, CollectionConfigurable, Copyable, Encryptable, Equality, Evolvable, Fields, Indexable, Interceptable, Matchable, Persistable, Reloadable, Scopable, SearchIndexable, Selectable, Serializable, Shardable, Stateful, Threaded::Lifecycle, Traversable, Validatable
- Included in:
- Document
- Defined in:
- lib/mongoid/composable.rb
Overview
This module provides inclusions of all behavior in a Mongoid document.
Constant Summary collapse
- MODULES =
[ Atomic, Attributes, Copyable, Changeable, Evolvable, Fields, Indexable, Inspectable, Interceptable, Matchable, Persistable, Association, Reloadable, Scopable, Serializable, Clients, Clients::Options, Shardable, Stateful, Cacheable, Threaded::Lifecycle, Traversable, Validatable, Equality, Association::Referenced::Syncable, Association::Macros, ActiveModel::Model, ActiveModel::Validations ]
- RESERVED_METHOD_NAMES =
These are methods names defined in included blocks that may conflict with user-defined association or field names. They won’t be in the list of Module.instance_methods on which the #prohibited_methods code below is dependent so we must track them separately.
[ :fields, :aliased_fields, :localized_fields, :index_specifications, :shard_key_fields, :nested_attributes, :readonly_attributes, :storage_options, :cascades, :cyclic, :cache_timestamp_format ]
Constants included from Interceptable
Constants included from Association
Constants included from Association::Depending
Association::Depending::STRATEGIES
Constants included from Persistable
Constants included from Fields
Fields::Boolean, Fields::IDS, Fields::INVALID_BSON_CLASSES, Fields::StringifiedSymbol, Fields::TYPE_MAPPINGS
Constants included from Atomic
Instance Attribute Summary
Attributes included from Stateful
#destroyed, #flagged_for_destroy, #previously_new_record
Attributes included from Association
Attributes included from Attributes
Attributes included from Mongoid::Clients::StorageOptions
Class Method Summary collapse
-
.prohibited_methods ⇒ Array<Symbol>
Get a list of methods that would be a bad idea to define as field names or override when including Mongoid::Document.
Methods included from Equality
Methods included from Copyable
Methods included from Interceptable
#_mongoid_run_child_after_callbacks, #_mongoid_run_child_before_callbacks, #_mongoid_run_child_callbacks, #_mongoid_run_child_callbacks_with_around, #_mongoid_run_child_callbacks_without_around, #callback_executable?, #in_callback_state?, #pending_callbacks, #pending_callbacks=, #run_after_callbacks, #run_before_callbacks, #run_callbacks, #run_pending_callbacks
Methods included from Validatable
#begin_validate, #exit_validate, #performing_validations?, #read_attribute_for_validation, #valid?, #validated?, #validating_with_query?
Methods included from Traversable
#_children, #_descendants, #_parent, #_parent=, #_reset_memoized_descendants!, #_root, #_root?, #collect_children, #collect_descendants, #flag_descendants_persisted, #hereditary?, #parentize, #remove_child, #reset_persisted_descendants
Methods included from Cacheable
Methods included from Stateful
#destroyed?, #flagged_for_destroy?, #new_record=, #new_record?, #persisted?, #previously_new_record?, #previously_persisted?, #pushable?, #readonly!, #readonly?, #settable?, #updateable?
Methods included from Shardable
#shard_key_field_value, #shard_key_fields, #shard_key_selector, #shard_key_selector_in_db
Methods included from Serializable
Methods included from Selectable
Methods included from Reloadable
Methods included from Association
#association_name, #embedded?, #embedded_many?, #embedded_one?, #referenced_many?, #referenced_one?, #reload_relations
Methods included from Association::Reflections
#reflect_on_all_association, #reflect_on_association
Methods included from Association::Macros
Methods included from Association::Depending
#apply_destroy_dependencies!, define_dependency!, validate!
Methods included from Association::Accessors
#__build__, #create_relation, #reset_relation_criteria, #set_relation
Methods included from Association::Referenced::Syncable
#_syncable?, #_synced, #_synced?, #remove_inverse_keys, #update_inverse_keys
Methods included from Association::Referenced::CounterCache
define_callbacks!, #reset_counters
Methods included from Association::Referenced::AutoSave
#__autosaving__, #autosaved?, #changed_for_autosave?, define_autosave!
Methods included from Persistable
#atomically, #fail_due_to_callback!, #fail_due_to_validation!
Methods included from Persistable::Unsettable
Methods included from Persistable::Upsertable
Methods included from Persistable::Updatable
#update, #update!, #update_attribute
Methods included from Persistable::Settable
Methods included from Persistable::Savable
Methods included from Persistable::Renamable
Methods included from Persistable::Pushable
Methods included from Persistable::Pullable
Methods included from Positional
Methods included from Persistable::Poppable
Methods included from Persistable::Multipliable
Methods included from Persistable::Minable
Methods included from Persistable::Maxable
Methods included from Persistable::Logical
Methods included from Persistable::Incrementable
Methods included from Persistable::Destroyable
Methods included from Persistable::Deletable
Methods included from Persistable::Creatable
Methods included from Matchable
Methods included from Fields
#apply_default, #apply_defaults, #apply_post_processed_defaults, #apply_pre_processed_defaults, #attribute_names, database_field_name, #database_field_name, #dot_dollar_field?, #lazy_settable?, option, options, traverse_association_tree, #using_object_ids?, #validate_writable_field_name!
Methods included from Evolvable
Methods included from Attributes
#assign_attributes, #attribute_missing?, #attribute_present?, #attributes_before_type_cast, #has_attribute?, #has_attribute_before_type_cast?, #process_raw_attribute, #read_attribute, #read_attribute_before_type_cast, #remove_attribute, #typed_attributes, #write_attribute, #write_attributes
Methods included from Attributes::Readonly
Methods included from Attributes::Processing
Methods included from Clients
clear, clients, default, disconnect, set, with_name
Methods included from Mongoid::Clients::Sessions
Methods included from Mongoid::Clients::Options
#collection, #collection_name, #mongo_client, #persistence_context, #persistence_context?, #with
Methods included from Mongoid::Clients::StorageOptions
#remember_storage_options!, #storage_options
Methods included from Changeable
#attribute_before_last_save, #changed, #changed?, #changed_attributes, #changes, #children_changed?, #move_changes, #post_persist, #previous_changes, #remove_change, #saved_change_to_attribute, #saved_change_to_attribute?, #setters, #will_save_change_to_attribute?
Methods included from Atomic
#add_atomic_pull, #add_atomic_unset, #atomic_array_add_to_sets, #atomic_array_pulls, #atomic_array_pushes, #atomic_attribute_name, #atomic_delete_modifier, #atomic_insert_modifier, #atomic_path, #atomic_paths, #atomic_position, #atomic_pulls, #atomic_pushes, #atomic_sets, #atomic_unsets, #atomic_updates, #delayed_atomic_pulls, #delayed_atomic_sets, #delayed_atomic_unsets, #flag_as_destroyed, #flagged_destroys, #process_flagged_destroys
Class Method Details
.prohibited_methods ⇒ Array<Symbol>
Get a list of methods that would be a bad idea to define as field names or override when including Mongoid::Document.
128 129 130 131 132 |
# File 'lib/mongoid/composable.rb', line 128 def prohibited_methods @prohibited_methods ||= MODULES.flat_map do |mod| mod.instance_methods.map(&:to_sym) end + RESERVED_METHOD_NAMES end |