Class: Typesensual::Callbacks

Inherits:
Object
  • Object
show all
Defined in:
lib/typesensual/callbacks.rb

Instance Method Summary collapse

Constructor Details

#initialize(index) ⇒ Callbacks

Returns a new instance of Callbacks.



5
6
7
# File 'lib/typesensual/callbacks.rb', line 5

def initialize(index)
  @index = index
end

Instance Method Details

#after_create_commit(record) ⇒ Object



9
10
11
# File 'lib/typesensual/callbacks.rb', line 9

def after_create_commit(record)
  @index.index_one(record.id)
end

#after_destroy_commit(record) ⇒ Object



17
18
19
# File 'lib/typesensual/callbacks.rb', line 17

def after_destroy_commit(record)
  @index.remove_one(record.id)
end

#after_update_commit(record) ⇒ Object



13
14
15
# File 'lib/typesensual/callbacks.rb', line 13

def after_update_commit(record)
  @index.index_one(record.id)
end