모듈: Mongoid::Association::Referenced::HasOne::Buildable
- 다음을 포함합니다.
- WithPolymorphicCriteria
- 다음에 정의됨:
- lib/mongoid/association/referenced/has_one/buildable.rb
개요
has_one 연관 관계에 대한 빌더 동작.
인스턴스 메서드 요약 접기
-
#build(base, 객체, _type = nil,selected_fields = nil) ⇒ 문서
이 메서드는 _id 또는 객체를 가져와서 ID 를 사용하여 역방향을 쿼리하거나 연결된 객체를 지운 후 객체를 설정합니다.
WithPolymorphicCriteria에포함된 메서드
인스턴스 메서드 세부 정보
#빌드(base, 객체, _type = nil,selected_fields = nil) ⇒ 문서
이 메서드는 _id 또는 객체를 가져와서 ID 를 사용하여 역방향을 쿼리하거나 연결된 객체를 지운 후 객체를 설정합니다.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# 파일 'lib/mongoid/association/referenced/has_one/buildable.rb', 줄 23 def 빌드(base, 객체, _type = nil, selected_fields = nil) 만약 쿼리?(객체) # $lookup 집계 에서 해시 배열 처리 만약 객체.is_a?(배열) && 객체.모두? { |o| o.is_a?(해시) } doc = 객체.first 반환 doc ? 공장.execute_from_db(class, doc, nil, selected_fields, execution_callbacks: 거짓) : nil end execution_query(객체, base) 하지 않는 한 base.new_record? other clear_related(객체) 객체 end end |