模块:Mongoid::Composable

扩展方式:
ActiveSupport::Concern
包括:
ActiveModel::ForbiddenAttributesProtection、ActiveModel::Model、ActiveModel::Serializers:: JSON、 Inspectable、 Association 、 Atomic 、 Attributes 、 Cacheable 、 Changeable 、 Clients 、 CollectionConfigurable 、 Copyable 、 Encryptable 、 Equality 、 Evolvable 、 Fields 、 Identifier 、 Indexable 、 Interceptable 、 Matchable 、 Persistable 、 Reloadable 、 Scopeable 、 SearchIndexable 、 Selectable 、 Serializable 、 Shardable 、 Stateful 、 Threaded::Lifecycle 、 Traversable 、 Validatable
包含在:
文档
定义于:
lib/mongoid/composable.rb

Overview

该模块包含 Mongoid文档中的所有行为。

常量摘要折叠

MODULES =
[
  原子性,
  属性,
  可复制,
  Changeable,
  可演进,
  字段,
  可转位,
  Inspectable,
  Interceptable,
  可匹配,
  Persistable,
  关联,
  可重新加载,
  作用域,
  可序列化,
  客户端,
  客户端::选项,
  可分片,
  有状态,
  可缓存,
  线程化::生命周期,
  可遍历,
  Validatable,
  相等,
  关联::引用::Syncable,
  关联::宏,
  ActiveModel::模型,
  ActiveModel::验证
]
RESERVED_METHOD_NAMES =

这些是在包含的区块中定义的方法名称,可能与用户定义的关联或字段名称冲突。它们不会出现在下面的 #prohibited_methods 代码所依赖的 Module.instance_methods 列表中,因此我们必须单独追踪它们。

返回:

  • ( Array<Symbol> ) —

    保留方法名称的列表。

%i[字段
aliased_fields
localized_fields
index_specifications
shard_key_fields
nested_attributes
readonly_attributes
storage_options
cascades
循环
cache_timestamp_format]

Interceptable中包含的常量

Interceptable::CALBACKS

关联中包含的常量

Association::MACRO_MAPPING

Association::Depending中包含的常量

Association::Depending::STRATEGIES

Persistable中包含的常量

Persistable::LIST_OPERATIONS

字段中包含的常量

Fields::Boolean 、 Fields::IDS 、 Fields::INVALID_BSON_CLASSES 、 Fields::StringifiedSymbol 、 Fields::TRANSLATIONS_SFX 、 Fields::TYPE_MAPPINGS

客户端包含的常量

Mongoid::Clients::CREATE_LOCK

Atomic中包含的常量

Atomic::UPDATES

实例属性摘要

Stateful中包含的属性

#destroyed 、 #flag_for_destroy 、 #previously_new_record

关联中包含的属性

#_association

属性中包含的属性

#attributes

Mongoid::Clients::StorageOptions 中包含的属性

#remembered_storage_options

类方法摘要折叠

Equality中包含的方法

#, #==, #eql?

Copyable中包含的方法

#clone, clone_with_hash

Interceptable中包含的方法

#_mongoid_run_child_after_callbacks 、 #_mongoid_run_child_before_callbacks 、 #_mongoid_run_child_callbacks 、 #_mongoid_run_child_callbacks_with_round 、 #_mongoid_run_child_callbacks_Without_round 、 #callback_executable? , #in_callback_state? 、 #pending_callbacks 、 #pending_callbacks= 、 #run_after_callbacks 、 #run_before_callbacks 、 #run_callbacks 、 #run_pending_callbacks

Validatable 中包含的方法

#begin_validate 、 #exit_validate 、 #performing_validations? 、#read_attribute_for_validation、#valid? , #validated? 、#validating、#validating_with_query?

从Traversable包含的方法

__redefine 、 #_children 、 #_descendants 、 #_parent 、 #_parent= 、 #_reset_memoized_descendants! 、#_root 、#_root? 、 #collect_children 、 #collect_descendants 、 #flag_descendants_persisted 、 #hereditary? 、 #parentize 、 #remove_child 、 #reset_persisted_descendants

Cacheable中包含的方法

#cache_key, #cache_version

Stateful中包含的方法

#destroyed? , #flag_for_destroy? , #new_record= , #new_record? , #persisted? , #previously_new_record? , #previously_persisted? , #pushable? , #readonly! , #readonly? , #settable? , #updateable?

Shardable 中包含的方法

#shard_key_field_value 、 #shard_key_fields 、 #shard_key_selector 、 #shard_key_selector_in_db

Serializable中包含的方法

#serializable_hash

Selectable中包含的方法

#atomic_selector

SearchIndexable 中包含的方法

#auto_embed_search, #vector_search

Reloadable中包含的方法

#reload

关联中包含的方法

#association_name 、 #embedded? , #embedded_many? , #embedded_one? , #referenced_many? , #referenced_one? , #reload_relations

Association::Reflections中包含的方法

#reflect_on_all_association 、 #reflect_on_association

Association::Macros中包含的方法

#associations

Association::构建者 中包含的方法

define_builder!、define_creator!

Association::Dependent中包含的方法

#apply_destroy_dependencies! , define_dependency! ,验证!

Association::Accessors中包含的方法

#__build__、#create_relation、define_builder!、define_creator!、define_existence_check!、define_getter!、define_ids_getter!、define_ids_setter!、define_setter!、#reset_relation_criteria、#set_relation

Association::Referenced::Syncable中包含的方法

#_syncable? 、 #_synced 、 #_synced? 、 #remove_inverse_keys 、 #update_inverse_keys

Association::Referenced::CounterCache中包含的方法

define_callbacks! , #reset_counters

Association::Referenced::AutoSave中包含的方法

#__autosaving__, #autosaved?, #changed_for_autosave?, define_autosave!

Persistable中包含的方法

#atomically 、 #fail_due_to_callback! , #fail_due_to_validation!

Persistable::Unsettable 中包含的方法

#unset

Persistable::Upsertable 中包含的方法

#upsert

Persistable::Updatable中包含的方法

#update, #update!, #update_attribute

Persistable::Settable中包含的方法

#set

Persistable::Savable中包含的方法

#save, #save!

Persistable::Renameable 中包含的方法

#rename

Persistable::Pushable 中包含的方法

#add_to_set 、 #push

Persistable::Pullable 中包含的方法

#pull , #pull_all

位置包含的方法

#positionally

Persistable::Poppable 中包含的方法

#pop

Persistable::Multipliable中包含的方法

#mul

Persistable::Minable 中包含的方法

#set_min

Persistable::Maxable中包含的方法

#set_max

Persistable::Logical中包含的方法

#bit

Persistable::Incrementable中包含的方法

#inc

Persistable::Destroyable中包含的方法

#destroy , #destroy!

Persistable::Deletable中包含的方法

# 删除

Persistable::Createtable中包含的方法

#insert

Matchable中包含的方法

#_matches?

字段中包含的方法

#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!

包含在Evolvable中的方法

#__evolve_object_id__

属性中包含的方法

#allow_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

Attributes::Readonly中包含的方法

#attribute_writable?

Attributes::Processing中包含的方法

#process_attributes

客户端包含的方法

clear、clients、 默认 、disconnect、reconnect、 设立 、with_name

Mongoid::Clients::Sessions 中包含的方法

包含

Mongoid::Clients::Options中包含的方法

# 集合 , #collection_name , #mongo_client , #persistence_context , #persistence_context? , #with

Mongoid::Clients::StorageOptions 中包含的方法

#remember_storage_options! , #storage_options

Changeable中包含的方法

#attribute_before_last_save、#changed、#changed?、#changed_attributes、#changes、#children_changed?、#children_may_have_changed!、#move_changes、#post_persist、#previous_changes、#remove_change、#saved_change_to_attribute、#saved_change_to_attribute?、#setters、#will_save_change_to_attribute?

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 、 #flag_destroys 、 #process_flag_destroys

类方法详细信息

。 Barceled_methods ⇒ Array<Symbol>

获取方法列表,在包含 Mongoid::Document 时,不建议将其定义为字段名称或覆盖。

例子:

坏事!

Mongoid::Components.prohibited_methods

返回:

  • ( Array<Symbol> )


126
127
128
129
130
# File 'lib/mongoid/composable.rb', line 126

def Barceled_methods
  @prohibited_methods ||= 模块.flat_map do |mod|
    mod.instance_methods.map(和:to_sym)
  end + RESERVED_METHOD_NAMES
end