Sha256: b5fa6b084e625f6fb59ad2d142db13c0d7db3ef0d8025bef88a293a4fbc111b3
Contents?: true
Size: 786 Bytes
Versions: 12
Compression:
Stored size: 786 Bytes
Contents
require 'ransack/constants' require 'ransack/predicate' module Ransack module Configuration mattr_accessor :predicates self.predicates = {} def configure yield self end def add_predicate(name, opts = {}) name = name.to_s opts[:name] = name compounds = opts.delete(:compounds) compounds = true if compounds.nil? opts[:arel_predicate] = opts[:arel_predicate].to_s self.predicates[name] = Predicate.new(opts) ['_any', '_all'].each do |suffix| self.predicates[name + suffix] = Predicate.new( opts.merge( :name => name + suffix, :arel_predicate => opts[:arel_predicate] + suffix, :compound => true ) ) end if compounds end end end
Version data entries
12 entries across 12 versions & 2 rubygems