##// END OF EJS Templates
Rails4: replace deprecated Relation#update_all at Issue model...
Toshi MARUYAMA -
r12257:8aa22a05f401
parent child
Show More
@@ -1222,7 +1222,7 class Issue < ActiveRecord::Base
1222
1222
1223 def after_project_change
1223 def after_project_change
1224 # Update project_id on related time entries
1224 # Update project_id on related time entries
1225 TimeEntry.update_all(["project_id = ?", project_id], {:issue_id => id})
1225 TimeEntry.where({:issue_id => id}).update_all(["project_id = ?", project_id])
1226
1226
1227 # Delete issue relations
1227 # Delete issue relations
1228 unless Setting.cross_project_issue_relations?
1228 unless Setting.cross_project_issue_relations?
@@ -1313,8 +1313,8 class Issue < ActiveRecord::Base
1313 self.root_id = (@parent_issue.nil? ? id : @parent_issue.root_id )
1313 self.root_id = (@parent_issue.nil? ? id : @parent_issue.root_id )
1314 target_maxright = nested_set_scope.maximum(right_column_name) || 0
1314 target_maxright = nested_set_scope.maximum(right_column_name) || 0
1315 offset = target_maxright + 1 - lft
1315 offset = target_maxright + 1 - lft
1316 Issue.update_all(["root_id = ?, lft = lft + ?, rgt = rgt + ?", root_id, offset, offset],
1316 Issue.where(["root_id = ? AND lft >= ? AND rgt <= ? ", old_root_id, lft, rgt]).
1317 ["root_id = ? AND lft >= ? AND rgt <= ? ", old_root_id, lft, rgt])
1317 update_all(["root_id = ?, lft = lft + ?, rgt = rgt + ?", root_id, offset, offset])
1318 self[left_column_name] = lft + offset
1318 self[left_column_name] = lft + offset
1319 self[right_column_name] = rgt + offset
1319 self[right_column_name] = rgt + offset
1320 if @parent_issue
1320 if @parent_issue
General Comments 0
You need to be logged in to leave comments. Login now