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

app/models/message.rb

index 4335fefa9a23b9ca899caf4e4e3b7a52cf597aa8..c4eb278481805e9a73af56d55aea2f6657056f6c 100644 (file)
@@ -68,7 +68,7 @@ class Message < ActiveRecord::Base
 
   def update_messages_board
     if board_id_changed?
-      Message.update_all({:board_id => board_id}, ["id = ? OR parent_id = ?", root.id, root.id])
+      Message.where(["id = ? OR parent_id = ?", root.id, root.id]).update_all({:board_id => board_id})
       Board.reset_counters!(board_id_was)
       Board.reset_counters!(board_id)
     end
@@ -76,7 +76,7 @@ class Message < ActiveRecord::Base
 
   def reset_counters!
     if parent && parent.id
-      Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id})
+      Message.where({:id => parent.id}).update_all({:last_reply_id => parent.children.maximum(:id)})
     end
     board.reset_counters!
   end