diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-03-15 08:27:38 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-03-15 08:27:38 +0000 |
commit | aec989707edc47161192eba74f1a88123b12360a (patch) | |
tree | 5a810a6a3fb4fb76b9cfdb439eedc666bf4d049a /app/controllers/trackers_controller.rb | |
parent | 993b60d61eb927cff21ea0b06c1631eb986f6a51 (diff) | |
download | redmine-aec989707edc47161192eba74f1a88123b12360a.tar.gz redmine-aec989707edc47161192eba74f1a88123b12360a.zip |
Workflow copy:
* added the ability the copy an existing workflow when creating a new role (closes #841)
* use a single raw insert statement to copy tracker/role workflow rather than instantiating hundreds/thousands of objects
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1252 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/trackers_controller.rb')
-rw-r--r-- | app/controllers/trackers_controller.rb | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index 46edea548..3d7dbd5c5 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -37,16 +37,12 @@ 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])) - 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 + @tracker.workflows.copy(copy_from) end flash[:notice] = l(:notice_successful_create) redirect_to :action => 'list' end - @trackers = Tracker.find :all + @trackers = Tracker.find :all, :order => 'position' end def edit |