##// END OF EJS Templates
Rails4: replace deprecated Relation#update_all at Message model...
Toshi MARUYAMA -
r12227:ab6ac3b08fe8
parent child
Show More
@@ -68,7 +68,7 class Message < ActiveRecord::Base
68 68
69 69 def update_messages_board
70 70 if board_id_changed?
71 Message.update_all({:board_id => board_id}, ["id = ? OR parent_id = ?", root.id, root.id])
71 Message.where(["id = ? OR parent_id = ?", root.id, root.id]).update_all({:board_id => board_id})
72 72 Board.reset_counters!(board_id_was)
73 73 Board.reset_counters!(board_id)
74 74 end
@@ -76,7 +76,7 class Message < ActiveRecord::Base
76 76
77 77 def reset_counters!
78 78 if parent && parent.id
79 Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id})
79 Message.where({:id => parent.id}).update_all({:last_reply_id => parent.children.maximum(:id)})
80 80 end
81 81 board.reset_counters!
82 82 end
General Comments 0
You need to be logged in to leave comments. Login now