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