类:Mongoid::Association::Embedded::EmbeddedIn

继承:
对象
  • 对象
显示全部
包括:
构建, 可相关
定义于:
lib/mongoid/association/embedded/embedded_in.rb ,
lib/mongoid/association/embedded/embedded_in/proxy.rb,
lib/mongoid/association/embedded/embedded_in/bounding.rb,
lib/mongoid/association/embedded/embedded_in/buildable.rb

Overview

EmbeddedIn 类型关联。

在命名空间下定义

模块: 可构建 类: 绑定,代理

常量摘要折叠

ASSOCIATION_OPTIONS =

除常用选项外,还可用于此类关联的选项。

返回:

  • ( Array<Symbol> )

    额外的有效选项。

[
    :autobuild,
    :循环,
    :poly态,
    :touch,
].冻结
VALID_OPTIONS =

此关联的有效选项的完整列表,包括共享选项。

返回:

  • ( Array<Symbol> )

    有效选项。

(ASSOCIATION_OPTIONS + SHARED_OPTIONS).冻结

Relatable 中包含的常量

Relatable::PRIMARY_KEY_DEFAULTRelatable::SHARED_OPTIONS

实例属性摘要

Relatable 中包含的属性

#name#options#parent_inclusions

实例方法摘要折叠

Buildable中包含的方法

#build

Relatable 中包含的方法

#==, #bindable?, #counter_cache_column_name, #create_relation, #destructive?, #extension, #foreign_key_check, #foreign_key_setter, #get_callbacks, #in_to?, #initialize, #inverse, #inverse_association, #inverse_class, #inverse_class_name, #inverse_setter, #inverse_type, #inverse_type_setter, #inverses, #many?, #one?, #path, #relation_class, #relation_class_name, #setter, #type_setter, #validate?

选项中包含的方法

#as , #autoBuilding? #autosave #cascading_callbacks? , #counter_cached? , #cycle? 、#depend、# forced_nil_inverse ? , #indexed? 、#inverse_of、# order、#store_as # touch_field # touchable? , #type

Constrainable中包含的方法

#convert_to_foreign_key

实例方法详细信息

# embedded?true

此关联类型是否为嵌入式?

返回:

  • ( true )

    始终为 true。



47
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 47

def 嵌入式? true end

#string

用于获取关联对象属性的键。

返回:

  • ( string )

    关联的名称。



67
68
69
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 67

def key
  @key ||= 名称.to_s
end

#nested_builder (attributes, options) ⇒ Association::Nested::One

嵌套构建器对象。

参数:

  • 属性 (哈希)

    用于构建关联对象的属性。

  • 选项 (哈希)

    关联的选项。

返回:



91
92
93
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 91

def nested_builder(属性, 选项)
  嵌套::one.new(self, 属性, 选项)
end

#多态?true | false

此关联是否具有多态性?

返回:

  • ( true | false )

    此关联是否为多态。



81
82
83
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 81

def 多态?
  !!@options[:poly态]
end

#primary_keynil

主键

返回:

  • ( nil )

    与此关联无关



52
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 52

def primary_key end

#关系Association::Embedded::EmbeddedIn::Proxy

获取此关联类型的关联代理类。

返回:



74
75
76
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 74

def 关系
  代理
end

# setup!self

在关联所属类上设置实例方法、字段等。

返回:

  • ( self )


37
38
39
40
41
42
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 37

def setup!
  setup_defaults!
  setup_instance_methods!
  @owner_class.嵌入式 = true
  self
end

#stores_foreign_key?false

此关联类型是否存储外键?

返回:

  • ( false )

    始终为 false。



57
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 57

def store_foreign_key? false end

# validation_defaultfalse

用于验证关联对象的默认。

返回:

  • ( false )

    始终为 false。



62
# File 'lib/mongoid/association/embedded/embedded_in.rb', line 62

def validation_default false end