Module: Ion::Entity

Defined in:
lib/ion/entity.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(to) ⇒ Object



2
3
4
# File 'lib/ion/entity.rb', line 2

def self.included(to)
  to.extend ClassMethods
end

Instance Method Details

#delete_ion_indicesObject

Call me before deletion



18
19
20
21
# File 'lib/ion/entity.rb', line 18

def delete_ion_indices
  ion = self.class.ion
  ion.index_types.each { |i_type| i_type.del(self) }
end

#update_ion_indicesObject

Call me after saving



7
8
9
10
11
12
13
14
15
# File 'lib/ion/entity.rb', line 7

def update_ion_indices
  ion = self.class.ion

  # Clear out previous indexes...
  ion.index_types.each { |i_type| i_type.deindex(self) }

  # And add new ones
  ion.indices.each { |index| index.index(self) }
end