From: Toshi MARUYAMA Date: Fri, 11 Dec 2020 14:17:49 +0000 (+0000) Subject: shorten long line of app/models/board.rb X-Git-Tag: 4.2.0~195 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=658e95afd244323bdb0256b4e6c137cd3cc50d9e;p=redmine.git shorten long line of app/models/board.rb git-svn-id: http://svn.redmine.org/redmine/trunk@20624 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/board.rb b/app/models/board.rb index 9931efb57..d9410327e 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -68,9 +68,13 @@ class Board < ActiveRecord::Base def self.reset_counters!(board_id) board_id = board_id.to_i Board.where(:id => board_id). - update_all(["topics_count = (SELECT COUNT(*) FROM #{Message.table_name} WHERE board_id=:id AND parent_id IS NULL)," + - " messages_count = (SELECT COUNT(*) FROM #{Message.table_name} WHERE board_id=:id)," + - " last_message_id = (SELECT MAX(id) FROM #{Message.table_name} WHERE board_id=:id)", :id => board_id]) + update_all( + ["topics_count = (SELECT COUNT(*) FROM #{Message.table_name}" \ + " WHERE board_id=:id AND parent_id IS NULL)," \ + " messages_count = (SELECT COUNT(*) FROM #{Message.table_name} WHERE board_id=:id)," \ + " last_message_id = (SELECT MAX(id) FROM #{Message.table_name} WHERE board_id=:id)", + :id => board_id] + ) end def self.board_tree(boards, parent_id=nil, level=0)