mirror of
https://github.com/anteo/redmine_custom_workflows.git
synced 2026-01-26 00:04:20 +00:00
NameError: uninitialized constant #122
This commit is contained in:
parent
f6dacdd3a2
commit
bf014a4b23
@ -34,17 +34,10 @@ class CustomWorkflow < ActiveRecord::Base
|
|||||||
validates_format_of :author, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :allow_blank => true
|
validates_format_of :author, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :allow_blank => true
|
||||||
validate :validate_syntax, :validate_scripts_presence, :if => Proc.new {|workflow| workflow.respond_to?(:observable) and workflow.active?}
|
validate :validate_syntax, :validate_scripts_presence, :if => Proc.new {|workflow| workflow.respond_to?(:observable) and workflow.active?}
|
||||||
|
|
||||||
if Rails::VERSION::MAJOR >= 4
|
|
||||||
default_scope { order(:position => :asc) }
|
default_scope { order(:position => :asc) }
|
||||||
projects_join_table = reflect_on_association(:projects).join_table
|
|
||||||
else
|
|
||||||
default_scope :order => 'position ASC'
|
|
||||||
projects_join_table = reflect_on_association(:projects).options[:join_table]
|
|
||||||
end
|
|
||||||
|
|
||||||
scope :active, lambda { where(:active => true) }
|
scope :active, lambda { where(:active => true) }
|
||||||
scope :for_project, (lambda do |project|
|
scope :for_project, (lambda do |project|
|
||||||
where("is_for_all=? OR EXISTS (SELECT * FROM #{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) }
|
scope :observing, lambda { |observable| where(:observable => observable) }
|
||||||
|
|||||||
@ -43,11 +43,7 @@ module RedmineCustomWorkflows
|
|||||||
end
|
end
|
||||||
|
|
||||||
[:before_add, :before_remove, :after_add, :after_remove].each do |observable|
|
[:before_add, :before_remove, :after_add, :after_remove].each do |observable|
|
||||||
send("#{observable}_for_attachments") << if Rails::VERSION::MAJOR >= 4
|
send("#{observable}_for_attachments") << lambda { |event, project, attachment| Project.attachments_callback(event, project, attachment) }
|
||||||
lambda { |event, project, attachment| Project.attachments_callback(event, project, attachment) }
|
|
||||||
else
|
|
||||||
lambda { |project, attachment| Project.attachments_callback(observable, project, attachment) }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -33,11 +33,7 @@ module RedmineCustomWorkflows
|
|||||||
end
|
end
|
||||||
|
|
||||||
[:before_add, :before_remove, :after_add, :after_remove].each do |observable|
|
[:before_add, :before_remove, :after_add, :after_remove].each do |observable|
|
||||||
send("#{observable}_for_attachments") << if Rails::VERSION::MAJOR >= 4
|
send("#{observable}_for_attachments") << lambda { |event, page, attachment| WikiPage.attachments_callback(event, page, attachment) }
|
||||||
lambda { |event, page, attachment| WikiPage.attachments_callback(event, page, attachment) }
|
|
||||||
else
|
|
||||||
lambda { |page, attachment| WikiPage.attachments_callback(observable, page, attachment) }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user