Method: QuerySyntax::CriteriaScope#to_s
- Defined in:
- lib/query_syntax/scope/criteria.rb
#to_s ⇒ Object
Collapse all conditions to a string
37 38 39 40 41 42 43 44 |
# File 'lib/query_syntax/scope/criteria.rb', line 37 def to_s value = @conditions.map do |key,values| query = values.map { |value| "#{key}:#{value}" }.join(" OR ") values.count > 1 ? "(#{query})" : query end.join(" AND ") conditions.count > 1 ? "(#{value})" : value end |