module PgSearch::ClassMethods
def multisearchable(options = {})
def multisearchable(options = {}) include PgSearch::Multisearchable class_attribute :pg_search_multisearchable_options self.pg_search_multisearchable_options = options end
def pg_search_scope(name, options)
def pg_search_scope(name, options) options_proc = if options.respond_to?(:call) options else unless options.respond_to?(:merge) raise ArgumentError, "pg_search_scope expects a Hash or Proc" end lambda { |query| {:query => query}.merge(options) } end method_proc = lambda do |*args| config = Configuration.new(options_proc.call(*args), self) scope_options = ScopeOptions.new(config) scope_options.apply(self) end if respond_to?(:define_singleton_method) define_singleton_method name, &method_proc else (class << self; self; end).send :define_method, name, &method_proc end end