Module: PhatPgsearch::ActiveRecord::ClassMethods

Defined in:
lib/phat_pgsearch/active_record.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#pgsearch_index(*args, &block) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/phat_pgsearch/active_record.rb', line 10

def pgsearch_index(*args, &block)
  unless @pgsearch_definitions.is_a? Hash
    include InstanceMethods
    extend SingletonMethods
    @pgsearch_definitions = {}
    before_save :build_pgsearch_index
  end
  @pgsearch_definitions[args.first.to_sym] = IndexDefinition.new(*args, &block)
end