NameError: uninitialized constant #122

This commit is contained in:
Karel Pičman 2019-04-03 14:21:21 +02:00
parent e041519c81
commit df13f8ba8a

View File

@ -56,7 +56,7 @@ class CustomWorkflow < ActiveRecord::Base
def self.run_shared_code(object)
log_message '= Running shared code', object
if CustomWorkflow.table_exists? # Due to DB migration
CustomWorkflow.active.where(:observable => :shared).find_each do |workflow|
CustomWorkflow.active.where(observable: :shared).find_each do |workflow|
unless workflow.run(object, :shared_code)
log_message '= Abort running shared code', object
return false
@ -68,7 +68,8 @@ class CustomWorkflow < ActiveRecord::Base
end
def self.run_custom_workflows(observable, object, event)
workflows = CustomWorkflow.active.observing(observable)
if CustomWorkflow.table_exists? # Due to DB migration
workflows = CustomWorkflow.active.where(observable: observable)
if PROJECT_OBSERVABLES.include? observable
return true unless object.project
workflows = workflows.for_project(object.project)
@ -82,6 +83,7 @@ class CustomWorkflow < ActiveRecord::Base
end
end
log_message "= Finished running #{event} custom workflows", object
end
true
end