Class: Workflow

Inherits:
WorkflowKit::Workflow
  • Object
show all
Defined in:
app/models/workflow.rb

Overview

< ActiveRecord::Base

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_mark_as_deceased_workflowObject



31
32
33
34
35
36
37
38
39
# File 'app/models/workflow.rb', line 31

def self.create_mark_as_deceased_workflow
  raise 'Workflow already present.' if self.find_mark_as_deceased_workflow
  workflow = Workflow.create(name: "Todesfall")
  step = workflow.steps.build
  step.sequence_index = 1
  step.brick_name = "MarkAsDeceasedBrick"
  step.save
  return workflow
end

.find_mark_as_deceased_workflowObject



27
28
29
# File 'app/models/workflow.rb', line 27

def self.find_mark_as_deceased_workflow
  Workflow.where(name: "Todesfall").first
end

.find_or_create_mark_as_deceased_workflowObject



23
24
25
# File 'app/models/workflow.rb', line 23

def self.find_or_create_mark_as_deceased_workflow
  self.find_mark_as_deceased_workflow || self.create_mark_as_deceased_workflow
end

Instance Method Details

#name_as_verbObject



10
11
12
13
14
15
16
17
# File 'app/models/workflow.rb', line 10

def name_as_verb
  
  # TODO: This is German only! Internationalize!
  name
    .gsub( /ung/, 'en' )
    .gsub( /ation/, 'ieren' )
    .downcase
end

#titleObject



6
7
8
# File 'app/models/workflow.rb', line 6

def title
  name
end

#wah_groupObject

> TODO: corporation



19
20
21
# File 'app/models/workflow.rb', line 19

def wah_group  # => TODO: corporation
  ( self.ancestor_groups & Corporation.all ).first
end