class Ransack::Helpers::FormBuilder
def predicate_select(options = {}, html_options = {})
def predicate_select(options = {}, html_options = {}) options[:compounds] = true if options[:compounds].nil? default = options.delete(:default) || Constants::CONT keys = if options[:compounds] Predicate.names else Predicate.names.reject { |k| k.match(/_(any|all)$/) } end if only = options[:only] if only.respond_to? :call keys = keys.select { |k| only.call(k) } else only = Array.wrap(only).map(&:to_s) keys = keys.select { |k| only.include? k.sub(/_(any|all)$/, ''.freeze) } end end collection = keys.map { |k| [k, Translate.predicate(k)] } object.predicate ||= Predicate.named(default) if can_use_default?(default, :predicate, keys) template_collection_select(:p, collection, options, html_options) end