Fixed: bulk destroying parent and child issues raises a stale object error (#7920).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5283 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2011-04-01 16:26:53 +00:00
parent 516320e82b
commit 4e7835c68c
2 changed files with 19 additions and 1 deletions
+7 -1
View File
@@ -236,7 +236,13 @@ class IssuesController < ApplicationController
return unless api_request?
end
end
@issues.each(&:destroy)
@issues.each do |issue|
begin
issue.reload.destroy
rescue ::ActiveRecord::RecordNotFound # raised by #reload if issue no longer exists
# nothing to do, issue was already deleted (eg. by a parent)
end
end
respond_to do |format|
format.html { redirect_back_or_default(:action => 'index', :project_id => @project) }
format.api { head :ok }