diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-04-01 16:26:53 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-04-01 16:26:53 +0000 |
commit | 4e7835c68c7dc6e1011f6513971f5561fcfd172d (patch) | |
tree | 0b1769b3901532d404001d92defb45c84c7d07fa /app/controllers/issues_controller.rb | |
parent | 516320e82b0f879fd0ac92be5d433812ae20f2d9 (diff) | |
download | redmine-4e7835c68c7dc6e1011f6513971f5561fcfd172d.tar.gz redmine-4e7835c68c7dc6e1011f6513971f5561fcfd172d.zip |
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
Diffstat (limited to 'app/controllers/issues_controller.rb')
-rw-r--r-- | app/controllers/issues_controller.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index f51188fcc..fdce296c4 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -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 } |