summaryrefslogtreecommitdiffstats
path: root/app/controllers/trackers_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-12-07 13:35:38 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-12-07 13:35:38 +0000
commita7c2b63fb61082bb54afe49880ebe0c21566ba3f (patch)
tree739647a332748674b84eed764a5ef5499780a8f6 /app/controllers/trackers_controller.rb
parent5e38bd93634b9135e5f294ec1823e8a6b04c3b64 (diff)
downloadredmine-a7c2b63fb61082bb54afe49880ebe0c21566ba3f.tar.gz
redmine-a7c2b63fb61082bb54afe49880ebe0c21566ba3f.zip
Transaction and performance improvement on workflow copy when creating a new tracker.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@958 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/trackers_controller.rb')
-rw-r--r--app/controllers/trackers_controller.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb
index 0fc91b527..46edea548 100644
--- a/app/controllers/trackers_controller.rb
+++ b/app/controllers/trackers_controller.rb
@@ -37,8 +37,10 @@ class TrackersController < ApplicationController
if request.post? and @tracker.save
# workflow copy
if !params[:copy_workflow_from].blank? && (copy_from = Tracker.find_by_id(params[:copy_workflow_from]))
- copy_from.workflows.each do |w|
- @tracker.workflows << w.clone
+ Workflow.transaction do
+ copy_from.workflows.find(:all, :include => [:role, :old_status, :new_status]).each do |w|
+ Workflow.create(:tracker_id => @tracker.id, :role => w.role, :old_status => w.old_status, :new_status => w.new_status)
+ end
end
end
flash[:notice] = l(:notice_successful_create)