클래스: Mongoid::Association::Referenced::HasMany
- 상속:
-
객체
- 객체
- Mongoid::Association::Referenced::HasMany
- 다음에 정의됨:
- lib/mongoid/association/referenced/has_many.rb,
lib/mongoid/association/referenced/has_many/eager.rb,
lib/mongoid/association/referenced/has_many/proxy.rb,
lib/mongoid/association/referenced/has_many/Binding.rb,
lib/mongoid/association/referenced/has_many/buildable.rb,
lib/mongoid/association/referenced/has_many/enumerable.rb more...
개요
has_many 연관 관계.
네임스페이스 아래에 정의됨
모듈: Buildable 클래스: 바인딩, Eager, Enumerable, Proxy
상수 요약 접기
- ASSOCIATION_OPTIONS =
일반적인 옵션 외에 이 유형의 연결에 사용할 수 있는 옵션이 있습니다.
[ :after_add, :after_remove, :as, :autosave, :before_add, :before_remove, :Dependent, :foreign_key, :order, :primary_key, :scope, ].동결
- VALID_OPTIONS =
공유 옵션을 포함하여 이 연결에 유효한 옵션의 전체 목록입니다.
(ASSOCIATION_OPTIONS + SHARED_OPTIONS).동결
- FORIGN_KEY_SUFFIX =
기본값 외래 키 접미사입니다.
'_id'.동결
Mongoid::Association::Relatable에서 포함된 상수
Mongoid::Association::Relatable::PRIMARY_KEY_DEFAULT, Mongoid::Association::Relatable::SHARED_OPTIONS
인스턴스 속성 요약
Mongoid::Association::Relatable에포함된 속성
#name, #options, #parent_inclusions
인스턴스 메서드 요약 접기
-
#add_polymorphic_criterion(criteria, object_class) ⇒ Mongoid::Criteria
사용 중단
더 이상 사용되지 않습니다.
9.0.x에서
-
#bindable?(doc) ⇒ true | false
이 연결을 사용하여 객체를 바인딩하려고 하면 오류가 발생해야 하는지 여부입니다.
-
#criteria(base) ⇒ Mongoid::Criteria
이 연관 관계를 쿼리하는 데 사용되는 기준입니다.
-
#embedded? ⇒ false
이 연결 유형이 포함되어 있나요?
-
#foreign_key ⇒ string
연관 관계 참조를 저장하기 위해 역방향에서 외래 키 필드 를 가져옵니다.
-
# 중첩된_빌더(속성, 옵션) ⇒ 연관 관계::중첩::다수
중첩된 빌더 객체 입니다.
-
#경로(문서) ⇒ 루트
제공된 문서 의 경로 계산기를 가져옵니다.
-
#다형성? ⇒ true | false
이 연관 관계는 다형성입니까?
-
#관계 ⇒ 연관 관계::HasMany::프록시
이 연결 유형에 대한 연결 프록시 클래스를 가져옵니다.
-
#관계 _complements ⇒ Array<Mongoid::Association::Relatable>
연관 관계 보완 목록입니다.
-
#범위 ⇒ Proc | 기호 | nil
연관 관계를 쿼리할 때 적용될 범위를 가져옵니다.
-
#설정! ⇒ 자기
인스턴스 메서드, 필드 등을 설정합니다.
-
#setup_instance_methods! ⇒ 자기
이 연결 유형을 가진 클래스에서 인스턴스 메서드를 설정합니다.
-
#stores_foreign_key? ⇒ true
이 연결 유형은 외래 키를 저장 하나요?
-
#유형 ⇒ string | nil
다형성인 경우 이 연관 관계의 유형입니다.
-
#validation_default ⇒ true
연결 객체 유효성 검사 의 기본값 입니다.
WithPolymorphicCriteria에포함된 메서드
Buildable에 포함된 메서드
Mongoid::Association::Relatable에포함된 메서드
#==, #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, #key, #many?, #one?, #relation_class, #relation_class_name, #setter, #type_setter, #validate?
옵션에 포함된 메서드
#as, #autobuild?, #autosave, #cascading_callbacks?, #counter_cached?, #Cyclic?, #Dependent, #forced_nil_inverse?, #indexed?, #inverse_of, #order, #primary_key, #store_as, #터치 필드, #터치 가능?
Constrainable에 포함된 메서드
인스턴스 메서드 세부 정보
#add_polymorphic_criterion(criteria, object_class) ⇒ Mongoid::Criteria
9.0.x에서
이 연관 관계가 다음과 같은 경우 Criteria 객체에 다형성 쿼리 기준을 추가합니다.
polymorphic.
이 메서드는 리팩터링에서 이름을 'with_polymorphic_criterion'으로 바꾸고 비공개로 설정한 후 남은 아티팩트인 것처럼 보입니다. 그럼에도 불구하고 이 메서드는 다른 곳에서는 참조되지 않으며 외부 클라이언트에게는 유용하지 않을 수 있습니다. 제거 해야 합니다.
142 143 144 145 146 147 148 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 142 def add_polymorphic_criterion(기준, object_class) 만약 다형성? 기준.위치(유형 => object_class.이름) other 기준 end end |
#bindable?(doc) ⇒ true | false
이 연결을 사용하여 객체를 바인딩하려고 하면 오류가 발생해야 하는지 여부입니다.
164 165 166 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 164 def 바인딩 가능?(doc) forced_nil_inverse? || (!!inverse && doc.필드.키.포함?(foreign_key)) end |
#criteria(base) ⇒ Mongoid::Criteria
이 연관 관계를 쿼리하는 데 사용되는 기준입니다.
116 117 118 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 116 def 기준(base) query_criteria(base.send(Primary_key), base) end |
#embedded? ⇒ false
이 연결 유형이 포함되어 있나요?
94 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 94 def ; 거짓; end |
#foreign_key ⇒ string
연관 관계 참조를 저장하기 위해 역방향에서 외래 키 필드 를 가져옵니다.
86 87 88 89 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 86 def foreign_key @foreign_key ||= @options[:foreign_key] ? @options[:foreign_key].to_s : default_foreign_key_field end |
# 중첩된_빌더(속성, 옵션) ⇒ 연관 관계::중첩::다수
중첩된 빌더 객체 입니다.
174 175 176 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 174 def 중첩된_빌더(속성, ) 중첩::Many.신규(self, 속성, ) end |
#경로(문서) ⇒ 루트
제공된 문서 의 경로 계산기를 가져옵니다.
186 187 188 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 186 def 경로(문서) 몽고이드::원자::경로::루트.신규(문서) end |
#다형성? ⇒ true | false
이 연관 관계는 다형성입니까?
154 155 156 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 154 def 다형성? @polymorphic ||= !!방식 end |
#관계 ⇒ 연관 관계::HasMany::프록시
이 연결 유형에 대한 연결 프록시 클래스를 가져옵니다.
109 110 111 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 109 def 관계 프록시 end |
#관계 _complements ⇒ Array<Mongoid::Association::Relatable>
연관 관계 보완 목록입니다.
53 54 55 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 53 def 관계_보완 @relation_complements ||= [ 참조됨::Belongs To ].동결 end |
#scope ⇒ Proc | Symbol | nil
연관 관계를 쿼리할 때 적용될 범위를 가져옵니다.
193 194 195 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 193 def 범위 @options[:scope] end |
#설정! ⇒ 자기
연결을 소유한 클래스에서 인스턴스 메서드, 필드 등을 설정합니다.
60 61 62 63 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 60 def 설정! setup_instance_methods! self end |
#setup_instance_methods! ⇒ 자기
이 연결 유형을 가진 클래스에서 인스턴스 메서드를 설정합니다.
68 69 70 71 72 73 74 75 76 77 78 79 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 68 def setup_instance_methods! 정의_게터! describe_ids_getter! define_setter! describe_ids_setter! 정의_존재_확인! describe_autosaver! 다형성! 정의_종속! @holder_class.validates_related(이름) 만약 유효성 검사? self end |
#stores_foreign_key? ⇒ true
이 연결 유형이 외래 키를 저장 하나요?
104 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 104 def Stores_foreign_key?; 거짓; end |
#유형 ⇒ string | nil
다형성 연관 관계에만 관련이 있습니다.
다형성인 경우 이 연관 관계의 유형입니다.
125 126 127 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 125 def 유형 @type ||= "#{as}_type" 만약 다형성? end |
#validation_default ⇒ true
연결 객체 유효성 검사 의 기본값 입니다.
99 |
# 파일 'lib/mongoid/association/referenced/has_many.rb', 줄 99 def validation_default; true; end |