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



321
322
323
# File 'lib/indexed_search/index.rb', line 321

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

.included(base) ⇒ Object

make the whole thing work when included and extended:



318
319
320
# File 'lib/indexed_search/index.rb', line 318

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

.initialize_methods(base) ⇒ Object

Raises:



324
325
326
327
328
# File 'lib/indexed_search/index.rb', line 324

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