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
-
#add_to_index ⇒ Object
Adds the current model instance to index.
-
#remove_from_index ⇒ Object
Removes the current model instance to index.
-
#update_index ⇒ Object
Updates current model instance index.
Instance Method Details
#add_to_index ⇒ Object
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_index ⇒ Object
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_index ⇒ Object
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 |