Sha256: 3e5379473230d89bc0598fa287560ae7f54abff50aa64b216d0331d09ec0298f

Contents?: true

Size: 677 Bytes

Versions: 5

Compression:

Stored size: 677 Bytes

Contents

module ActsAsIndexed

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

    # Adds the current model instance to index.
    # Called by ActiveRecord on +save+.
    def add_to_index
      self.class.index_add(self)
    end

    # Removes the current model instance to index.
    # Called by ActiveRecord on +destroy+.
    def remove_from_index
      self.class.index_remove(self)
    end

    # Updates current model instance index.
    # Called by ActiveRecord on +update+.
    def update_index
      self.class.index_update(self)
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
acts_as_indexed-0.9.0 lib/acts_as_indexed/instance_methods.rb
acts_as_indexed-0.8.3 lib/acts_as_indexed/instance_methods.rb
acts_as_indexed-0.8.2 lib/acts_as_indexed/instance_methods.rb
acts_as_indexed-0.8.1 lib/acts_as_indexed/instance_methods.rb
acts_as_indexed-0.8.0 lib/acts_as_indexed/instance_methods.rb