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
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