1 class Workflow < ArvadosModel
4 include CommonApiTemplate
6 validate :validate_definition
7 before_save :set_name_and_description
9 api_accessible :user, extend: :common do |t|
15 def validate_definition
17 @definition_yaml = YAML.load self.definition if !definition.nil?
19 errors.add :definition, "is not valid yaml: #{e.message}"
23 def set_name_and_description
26 old_wf = YAML.load self.definition_was if !self.definition_was.nil?
28 logger.warn "set_name_and_description error: #{e.message}"
32 ['name', 'description'].each do |a|
33 if !self.changes.include?(a)
34 v = self.read_attribute(a)
35 if !v.present? or v == old_wf[a]
36 val = @definition_yaml[a] if self.definition and @definition_yaml