Class: Wco::OfficeAction
- Inherits:
-
Object
- Object
- Wco::OfficeAction
- Includes:
- Mongoid::Document, Mongoid::Paranoia, Mongoid::Timestamps
- Defined in:
- app/models/wco/office_action.rb
Constant Summary collapse
- STATUS_ACTIVE =
'active'- STATUS_INACTIVE =
'inactive'- STATUSS =
[ STATUS_ACTIVE, STATUS_INACTIVE ]
Instance Method Summary collapse
Instance Method Details
#do_run ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/models/wco/office_action.rb', line 26 def do_run sch = self sch.update!({ status: STATUS_INACTIVE }) begin eval( sch.tmpl.action_exe ) rescue => err puts! err, "Wco::OfficeAction#do_run" ::ExceptionNotifier.notify_exception( err, data: { office_action: self } ) end # schedule next actions & update the action sch.tmpl.ties.each do |tie| next_sch = self.class.find_or_initialize_by({ office_action_template_id: tie.next_tmpl.id, }) next_sch.perform_at = eval(tie.next_at_exe) next_sch.status = STATUS_ACTIVE next_sch.save! end end |
#tmpl ⇒ Object
14 15 16 |
# File 'app/models/wco/office_action.rb', line 14 def tmpl office_action_template end |
#to_s ⇒ Object
51 52 53 |
# File 'app/models/wco/office_action.rb', line 51 def to_s slug end |