Sha256: f0706b92c690f0de42ba4152616dedc7c776a8a60c507e2fb7b4928c02156308

Contents?: true

Size: 494 Bytes

Versions: 2

Compression:

Stored size: 494 Bytes

Contents

module Ransack
  module Nodes
    class Condition

      def arel_predicate
        predicates = attributes.map do |attr|
          attr.attr.send(
            arel_predicate_for_attribute(attr),
            formatted_values_for_attribute(attr)
          )
        end

        if predicates.size > 1 && combinator == 'and'
          Arel::Nodes::Grouping.new(Arel::Nodes::And.new(predicates))
        else
          predicates.inject(&:or)
        end
      end

    end # Condition
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ransack-1.8.10 lib/ransack/adapters/mongoid/ransack/nodes/condition.rb
ransack-1.8.9 lib/ransack/adapters/mongoid/ransack/nodes/condition.rb