NameError: uninitialized constant #122

This commit is contained in:
Karel Pičman 2019-04-03 13:51:10 +02:00
parent 1ba81a33a2
commit 7c8ee589cb
2 changed files with 5 additions and 5 deletions

View File

@ -39,7 +39,6 @@ class CustomWorkflow < ActiveRecord::Base
where("is_for_all=? OR EXISTS (SELECT * FROM #{reflect_on_association(:projects).join_table} WHERE project_id=? AND custom_workflow_id=id)", where("is_for_all=? OR EXISTS (SELECT * FROM #{reflect_on_association(:projects).join_table} WHERE project_id=? AND custom_workflow_id=id)",
true, project.id) true, project.id)
end) end)
scope :observing, lambda { |observable| where(:observable => observable) }
def self.import_from_xml(xml) def self.import_from_xml(xml)
attributes = Hash.from_xml(xml).values.first attributes = Hash.from_xml(xml).values.first
@ -55,7 +54,7 @@ class CustomWorkflow < ActiveRecord::Base
end end
def self.run_shared_code(object) def self.run_shared_code(object)
workflows = CustomWorkflow.observing(:shared).active workflows = CustomWorkflow.active.where(:observable => :shared)
log_message '= Running shared code', object log_message '= Running shared code', object
workflows.each do |workflow| workflows.each do |workflow|
unless workflow.run(object, :shared_code) unless workflow.run(object, :shared_code)

View File

@ -3,9 +3,10 @@
<%= hidden_field_tag 'project[custom_workflow_ids][]', '' %> <%= hidden_field_tag 'project[custom_workflow_ids][]', '' %>
<fieldset> <fieldset>
<legend><%= l(:text_select_project_custom_workflows) %></legend> <legend><%= l(:text_select_project_custom_workflows) %></legend>
<% if CustomWorkflow.observing(CustomWorkflow::PROJECT_OBSERVABLES).exists? %> <% cws = CustomWorkflow.where(observable: CustomWorkflow::PROJECT_OBSERVABLES) %>
<% if cws.any? %>
<dl> <dl>
<% CustomWorkflow.observing(CustomWorkflow::PROJECT_OBSERVABLES).each do |w| %> <% cws.find_each do |w| %>
<dt class="<%= 'disabled' unless w.active? %>"> <dt class="<%= 'disabled' unless w.active? %>">
<label> <label>
<%= check_box_tag 'project[custom_workflow_ids][]', w.id, @project.custom_workflow_ids.include?(w.id) || w.is_for_all?, :disabled => w.is_for_all? %> <%= w.name %> <%= check_box_tag 'project[custom_workflow_ids][]', w.id, @project.custom_workflow_ids.include?(w.id) || w.is_for_all?, :disabled => w.is_for_all? %> <%= w.name %>