def all(constraints = {})
      q = query( {limit: :max}.merge(constraints) )
      if block_given?
        # if we have a query, then use the Proc with it (more efficient)
        return q.present? ? q.results(&Proc.new) : collection.each(&Proc.new)
      end
      # if no block given, get all the results
      q.present? ? q.results : collection
    end
def all(constraints = {})
      q = query( {limit: :max}.merge(constraints) )
      if block_given?
        
        return q.present? ? q.results(&Proc.new) : collection.each(&Proc.new)
      end
      
      q.present? ? q.results : collection
    end
def all ( constraints = { } ) q = query ( { limit : :max } . merge ( constraints ) ) if block_given? # if we have a query, then use the Proc with it (more efficient) return q . present? ? q . results ( Proc . new ) : collection . each ( Proc . new ) end # if no block given, get all the results q . present? ? q . results : collection end
You can get items within the collection relation filtered by a specific set
 of query constraints.
You can get items within the collection relation filtered by a specific set of query constraints .