Class: Jsm::EventExecutor::Mongoid

Inherits:
ActiveModel show all
Defined in:
lib/jsm/event_executor/mongoid.rb

Instance Attribute Summary

Attributes inherited from Base

#state_machine, #validators

Instance Method Summary collapse

Methods inherited from ActiveModel

#can_be_executed?

Methods inherited from Base

#can_be_executed?, #execute, #execute!, #initialize

Constructor Details

This class inherits a constructor from Jsm::EventExecutor::Base

Instance Method Details

#execute_action(event, obj) ⇒ Object



2
3
4
5
6
7
# File 'lib/jsm/event_executor/mongoid.rb', line 2

def execute_action(event, obj)
  return false unless can_be_executed?(event, obj)
  # do transaction to prevent shit happen
  event.execute(obj)
  obj.save
end