Class: Riaction::CrudEventCallback

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

Instance Method Summary collapse

Constructor Details

#initialize(event_name) ⇒ CrudEventCallback

Returns a new instance of CrudEventCallback.



93
94
95
# File 'lib/riaction/riaction.rb', line 93

def initialize(event_name)
  @event_name = event_name
end

Instance Method Details

#after_create(record) ⇒ Object



97
98
99
100
101
# File 'lib/riaction/riaction.rb', line 97

def after_create(record)
  if record.riaction_log_event?(@event_name)
    Resque.enqueue(Riaction::EventPerformer, @event_name, record.class.base_class.to_s, record.id)
  end
end

#after_destroy(record) ⇒ Object



109
110
111
112
113
# File 'lib/riaction/riaction.rb', line 109

def after_destroy(record)
  if record.riaction_log_event?(@event_name)
    Resque.enqueue(Riaction::EventPerformer, @event_name, record.class.base_class.to_s, record.id)
  end
end

#after_update(record) ⇒ Object



103
104
105
106
107
# File 'lib/riaction/riaction.rb', line 103

def after_update(record)            
  if record.riaction_log_event?(@event_name)
    Resque.enqueue(Riaction::EventPerformer, @event_name, record.class.base_class.to_s, record.id)
  end
end