Rails4: replace deprecated Relation#update_all at IssuesController

git-svn-id: http://svn.redmine.org/redmine/trunk@12580 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2014-01-10 03:39:51 +00:00
parent 09147940fa
commit 0a72533b59

View File

@ -310,14 +310,15 @@ class IssuesController < ApplicationController
when 'destroy' when 'destroy'
# nothing to do # nothing to do
when 'nullify' when 'nullify'
TimeEntry.update_all('issue_id = NULL', ['issue_id IN (?)', @issues]) TimeEntry.where(['issue_id IN (?)', @issues]).update_all('issue_id = NULL')
when 'reassign' when 'reassign'
reassign_to = @project.issues.find_by_id(params[:reassign_to_id]) reassign_to = @project.issues.find_by_id(params[:reassign_to_id])
if reassign_to.nil? if reassign_to.nil?
flash.now[:error] = l(:error_issue_not_found_in_project) flash.now[:error] = l(:error_issue_not_found_in_project)
return return
else else
TimeEntry.update_all("issue_id = #{reassign_to.id}", ['issue_id IN (?)', @issues]) TimeEntry.where(['issue_id IN (?)', @issues]).
update_all("issue_id = #{reassign_to.id}")
end end
else else
# display the destroy form if it's a user request # display the destroy form if it's a user request