app/models/concerns/arel_helpers.rb
# Makes a more legible series of OR conditions.
# @return [Arel::Nodes::Grouping(Arel::Nodes::Or)]
Makes a more legible series of OR conditions.
Makes a more legible series of OR conditions .
def arel_or_expressions(*expressions)
      expressions.flatten!
      return block_given? ? yield(expressions[0]) : expressions[0] if expressions.one?
      expressions.reduce do |grouping, expression|
        expression = yield expression if block_given?
        next grouping if expression.blank?
        if grouping.kind_of?(Arel::Nodes::Grouping)
          grouping.expr.or(expression)
        else
          grouping = yield grouping if block_given?
          grouping.or(expression)
        end
      end
    end
def arel_or_expressions ( * expressions ) expressions . flatten! return block_given? ? yield ( expressions [ 0 ] ) : expressions [ 0 ] if expressions . one? expressions . reduce do | grouping , expression | expression = yield expression if block_given? next grouping if expression . blank? if grouping . kind_of? ( Arel :: Nodes :: Grouping ) grouping . expr . or ( expression ) else grouping = yield grouping if block_given? grouping . or ( expression ) end end end
Makes a more legible series of OR conditions.
Makes a more legible series of OR conditions .
# First expression
None
Arel::Nodes::Grouping(Arel::Nodes::Or)
expressions