module TkhSearch::TkhSearchable::LocalInstanceMethods
Public Instance Methods
index_record()
click to toggle source
# File lib/tkh_search/tkh_searchable.rb, line 67 def index_record # get record's model name, constantize it, and call the indexing class method (Kernel.const_get self.class.name).index_individual_record(self) remove_obsolete_instances end
Private Instance Methods
remove_obsolete_instances()
click to toggle source
# File lib/tkh_search/tkh_searchable.rb, line 75 def remove_obsolete_instances # after an individual record save and the record has been reindexed # we need to remove indexed instances for words which have been deleted obsolete_instances = TkhSearchInstance.where( 'host_model_name = ? and model_record_id = ?', self.class.name, self.id ).a_bit_old obsolete_instances.each do |instance| instance.destroy! end end