From 8aa22a05f401035503fbfd2ecc47a44e2f39b412 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Wed, 8 Jan 2014 12:20:52 +0000 Subject: [PATCH] Rails4: replace deprecated Relation#update_all at Issue model git-svn-id: http://svn.redmine.org/redmine/trunk@12532 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/issue.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index a211ef25d..295cedbc8 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -1222,7 +1222,7 @@ class Issue < ActiveRecord::Base def after_project_change # Update project_id on related time entries - TimeEntry.update_all(["project_id = ?", project_id], {:issue_id => id}) + TimeEntry.where({:issue_id => id}).update_all(["project_id = ?", project_id]) # Delete issue relations unless Setting.cross_project_issue_relations? @@ -1313,8 +1313,8 @@ class Issue < ActiveRecord::Base self.root_id = (@parent_issue.nil? ? id : @parent_issue.root_id ) target_maxright = nested_set_scope.maximum(right_column_name) || 0 offset = target_maxright + 1 - lft - Issue.update_all(["root_id = ?, lft = lft + ?, rgt = rgt + ?", root_id, offset, offset], - ["root_id = ? AND lft >= ? AND rgt <= ? ", old_root_id, lft, rgt]) + Issue.where(["root_id = ? AND lft >= ? AND rgt <= ? ", old_root_id, lft, rgt]). + update_all(["root_id = ?, lft = lft + ?, rgt = rgt + ?", root_id, offset, offset]) self[left_column_name] = lft + offset self[right_column_name] = rgt + offset if @parent_issue