class MongoidEmbedFinder::NestedQuery

Attributes

child_criteria[R]
parent_criteria[R]

Public Class Methods

new(parent_criteria, child_criteria) click to toggle source
# File lib/mongoid_embed_finder/nested_query.rb, line 5
def initialize(parent_criteria, child_criteria)
  @parent_criteria = parent_criteria
  @child_criteria  = child_criteria
end

Public Instance Methods

execute() click to toggle source
# File lib/mongoid_embed_finder/nested_query.rb, line 18
def execute
  parent_criteria.collection
    .find(parent_criteria.selector)
end
scope_child(conditions = {}) click to toggle source
# File lib/mongoid_embed_finder/nested_query.rb, line 14
def scope_child(conditions = {})
  @child_criteria = @child_criteria.where(conditions)
end
scope_parent(conditions = {}) click to toggle source
# File lib/mongoid_embed_finder/nested_query.rb, line 10
def scope_parent(conditions = {})
  @parent_criteria = @parent_criteria.where(conditions)
end