]> source.dussan.org Git - redmine.git/commitdiff
Rails4: replace deprecated Relation#update_all at Issue model
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 8 Jan 2014 12:20:52 +0000 (12:20 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 8 Jan 2014 12:20:52 +0000 (12:20 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@12532 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue.rb

index a211ef25db0351af30ef79a9714494cb4318800c..295cedbc8b9b508531e7923da0eaf1696c5b25a4 100644 (file)
@@ -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