module Asari::ActiveRecord
Public: This module should be included in any class inheriting from ActiveRecord::Base that needs to be indexed. Every time this module is included, asari_index must be called (see below). Including this module will automatically create before_destroy, after_create, and after_update AR callbacks to remove, add, and update items in the CloudSearch index (respectively).
Public Class Methods
included(base)
click to toggle source
# File lib/asari/active_record.rb, line 10 def self.included(base) base.extend(ClassMethods) base.class_eval do before_destroy :asari_remove_from_index after_create :asari_add_to_index after_update :asari_update_in_index end end
Public Instance Methods
asari_add_to_index()
click to toggle source
# File lib/asari/active_record.rb, line 24 def asari_add_to_index self.class.asari_add_item(self) end
asari_remove_from_index()
click to toggle source
# File lib/asari/active_record.rb, line 20 def asari_remove_from_index self.class.asari_remove_item(self) end
asari_update_in_index()
click to toggle source
# File lib/asari/active_record.rb, line 28 def asari_update_in_index self.class.asari_update_item(self) end