Module: ActsAsIndexed::InstanceMethods

Defined in:
lib/acts_as_indexed/instance_methods.rb

Overview

Adds model class instance methods. Methods are called automatically by ActiveRecord on save, destroy, and update of model instances.

Instance Method Summary collapse

Instance Method Details

#add_to_indexObject

Adds the current model instance to index. Called by ActiveRecord on save.



10
11
12
# File 'lib/acts_as_indexed/instance_methods.rb', line 10

def add_to_index
  self.class.index_add(self)
end

#remove_from_indexObject

Removes the current model instance to index. Called by ActiveRecord on destroy.



16
17
18
# File 'lib/acts_as_indexed/instance_methods.rb', line 16

def remove_from_index
  self.class.index_remove(self)
end

#update_indexObject

Updates current model instance index. Called by ActiveRecord on update.



22
23
24
# File 'lib/acts_as_indexed/instance_methods.rb', line 22

def update_index
  self.class.index_update(self)
end