Module: IndexedSearch::Index

Defined in:
lib/indexed_search/index.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: BadModelException

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



331
332
333
# File 'lib/indexed_search/index.rb', line 331

def self.extended(base)
  initialize_methods(base)
end

.included(base) ⇒ Object

make the whole thing work when included and extended:



328
329
330
# File 'lib/indexed_search/index.rb', line 328

def self.included(base)
  initialize_methods(base)
end

.initialize_methods(base) ⇒ Object

Raises:



334
335
336
337
338
# File 'lib/indexed_search/index.rb', line 334

def self.initialize_methods(base)
  base.instance_eval { include IndexedSearch::Index::InstanceMethods }
  base.extend IndexedSearch::Index::ClassMethods
  raise BadModelException.new("#{base.name} does not appear to be an ActiveRecord model.") unless base.respond_to?(:has_many)
end