summaryrefslogtreecommitdiffstats
path: root/app/models/workflow_rule.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-12-10 13:33:36 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-12-10 13:33:36 +0000
commit163fda086f92e2748412fcfe11c691cb0229fca6 (patch)
tree91df829c265a7469026db8858a7990b354286f73 /app/models/workflow_rule.rb
parent0fe9d4785c964ed6618f58dee3de93f37154d737 (diff)
downloadredmine-163fda086f92e2748412fcfe11c691cb0229fca6.tar.gz
redmine-163fda086f92e2748412fcfe11c691cb0229fca6.zip
shorten long line of app/models/workflow_rule.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@20606 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/workflow_rule.rb')
-rw-r--r--app/models/workflow_rule.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/app/models/workflow_rule.rb b/app/models/workflow_rule.rb
index b3d01a6ae..896066123 100644
--- a/app/models/workflow_rule.rb
+++ b/app/models/workflow_rule.rb
@@ -30,7 +30,10 @@ class WorkflowRule < ActiveRecord::Base
# Copies workflows from source to targets
def self.copy(source_tracker, source_role, target_trackers, target_roles)
unless source_tracker.is_a?(Tracker) || source_role.is_a?(Role)
- raise ArgumentError.new("source_tracker or source_role must be specified, given: #{source_tracker.class.name} and #{source_role.class.name}")
+ raise ArgumentError.new(
+ "source_tracker or source_role must be specified, given: " \
+ "#{source_tracker.class.name} and #{source_role.class.name}"
+ )
end
target_trackers = [target_trackers].flatten.compact
@@ -64,10 +67,15 @@ class WorkflowRule < ActiveRecord::Base
else
transaction do
where(:tracker_id => target_tracker.id, :role_id => target_role.id).delete_all
- connection.insert "INSERT INTO #{WorkflowRule.table_name} (tracker_id, role_id, old_status_id, new_status_id, author, assignee, field_name, #{connection.quote_column_name 'rule'}, type)" +
- " SELECT #{target_tracker.id}, #{target_role.id}, old_status_id, new_status_id, author, assignee, field_name, #{connection.quote_column_name 'rule'}, type" +
- " FROM #{WorkflowRule.table_name}" +
- " WHERE tracker_id = #{source_tracker.id} AND role_id = #{source_role.id}"
+ connection.insert(
+ "INSERT INTO #{WorkflowRule.table_name}" \
+ " (tracker_id, role_id, old_status_id, new_status_id," \
+ " author, assignee, field_name, #{connection.quote_column_name 'rule'}, type)" \
+ " SELECT #{target_tracker.id}, #{target_role.id}, old_status_id, new_status_id," \
+ " author, assignee, field_name, #{connection.quote_column_name 'rule'}, type" \
+ " FROM #{WorkflowRule.table_name}" \
+ " WHERE tracker_id = #{source_tracker.id} AND role_id = #{source_role.id}"
+ )
end
true
end