lib/parse/query.rb
def or_where(where_clauses = [])
      where_clauses = where_clauses.where if where_clauses.is_a?(Parse::Query)
      where_clauses = Parse::Query.new(@table, where_clauses ).where if where_clauses.is_a?(Hash)
      return self if where_clauses.blank?
      # we can only have one compound query constraint. If we need to add another OR clause
      # let's find the one we have (if any)
      compound = @where.find { |f| f.is_a?(Parse::Constraint::CompoundQueryConstraint) }
      # create a set of clauses that are not an OR clause.
      remaining_clauses = @where.select { |f| f.is_a?(Parse::Constraint::CompoundQueryConstraint) == false }
      # if we don't have a OR clause to reuse, then create a new one with then
      # current set of constraints
      if compound.blank?
        compound = Parse::Constraint::CompoundQueryConstraint.new :or, [ Parse::Query.compile_where(remaining_clauses) ]
      end
      # then take the where clauses from the second query and append them.
      compound.value.push Parse::Query.compile_where(where_clauses)
      #compound = Parse::Constraint::CompoundQueryConstraint.new :or, [remaining_clauses, or_where_query.where]
      @where = [compound]
      self #chaining
    end
def or_where(where_clauses = [])
      where_clauses = where_clauses.where if where_clauses.is_a?(Parse::Query)
      where_clauses = Parse::Query.new(@table, where_clauses ).where if where_clauses.is_a?(Hash)
      return self if where_clauses.blank?
      # we can only have one compound query constraint. If we need to add another OR clause
      # let's find the one we have (if any)
      compound = @where.find { |f| f.is_a?(Parse::Constraint::CompoundQueryConstraint) }
      # create a set of clauses that are not an OR clause.
      remaining_clauses = @where.select { |f| f.is_a?(Parse::Constraint::CompoundQueryConstraint) == false }
      # if we don't have a OR clause to reuse, then create a new one with then
      # current set of constraints
      if compound.blank?
        compound = Parse::Constraint::CompoundQueryConstraint.new :or, [ Parse::Query.compile_where(remaining_clauses) ]
      end
      # then take the where clauses from the second query and append them.
      compound.value.push Parse::Query.compile_where(where_clauses)
      #compound = Parse::Constraint::CompoundQueryConstraint.new :or, [remaining_clauses, or_where_query.where]
      @where = [compound]
      self #chaining
    end
def or_where ( where_clauses = [ ] ) where_clauses = where_clauses . where if where_clauses . is_a? ( Parse :: Query ) where_clauses = Parse :: Query . new ( @table , where_clauses ) . where if where_clauses . is_a? ( Hash ) return self if where_clauses . blank? # we can only have one compound query constraint. If we need to add another OR clause # let's find the one we have (if any) compound = @where . find { | f | f . is_a? ( Parse :: Constraint :: CompoundQueryConstraint ) } # create a set of clauses that are not an OR clause. remaining_clauses = @where . select { | f | f . is_a? ( Parse :: Constraint :: CompoundQueryConstraint ) == false } # if we don't have a OR clause to reuse, then create a new one with then # current set of constraints if compound . blank? compound = Parse :: Constraint :: CompoundQueryConstraint . new :or , [ Parse :: Query . compile_where ( remaining_clauses ) ] end # then take the where clauses from the second query and append them. compound . value . push Parse :: Query . compile_where ( where_clauses ) #compound = Parse::Constraint::CompoundQueryConstraint.new :or, [remaining_clauses, or_where_query.where] @where = [ compound ] self #chaining end
Combine two where clauses into an OR constraint. Equivalent to the `$or`
 Parse query operation. This is useful if you want to find objects that
 match several queries. We overload the `|` operator in order to have a
 clean syntax for joining these `or` operations.
 @example
  query = Player.where(:wins.gt => 150)
  query.or_where(:wins.lt => 5)
  # where wins > 150 || wins < 5
  results = query.results

  # or_query = query1 | query2 | query3 ...
  # ex. where wins > 150 || wins < 5
  query = Player.where(:wins.gt => 150) | Player.where(:wins.lt => 5)
  results = query.results
 @param where_clauses [Array<Parse::Constraint>] a list of Parse::Constraint objects to combine.
 @return [Query] the combined query with an OR clause.
Combine two where clauses into an OR constraint . Equivalent to the $or Parse query operation . This is useful if you want to find objects that match several queries . We overload the | operator in order to have a clean syntax for joining these or operations . @example query = Player . where ( : wins . gt = > 150 ) query . or_where ( : wins . lt = > 5 ) # where wins > 150 || wins < 5 results = query . results