Rails4: replace deprecated Relation#update_all at Message model

git-svn-id: http://svn.redmine.org/redmine/trunk@12502 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2014-01-08 03:51:50 +00:00
parent 0788000809
commit ab6ac3b08f
1 changed files with 2 additions and 2 deletions

View 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