Module: Mongoid::Association::Referenced::HasAndBelongsToMany::Buildable
- Defined in:
- build/mongoid-7.3/lib/mongoid/association/referenced/has_and_belongs_to_many/buildable.rb
Overview
The Builder behavior for has_and_belongs_to_many associations.
Instance Method Summary collapse
-
#build(base, object, type = nil, selected_fields = nil) ⇒ Array<Document>
This builder either takes a hash and queries for the object or an array of documents, where it will just return them.
Instance Method Details
#build(base, object, type = nil, selected_fields = nil) ⇒ Array<Document>
This builder either takes a hash and queries for the object or an array of documents, where it will just return them.
26 27 28 29 30 31 32 |
# File 'build/mongoid-7.3/lib/mongoid/association/referenced/has_and_belongs_to_many/buildable.rb', line 26 def build(base, object, type = nil, selected_fields = nil) if query?(object) query_criteria(object) else object.try(:dup) end end |