]> source.dussan.org Git - redmine.git/commitdiff
shorten long line of app/models/board.rb
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 11 Dec 2020 14:17:49 +0000 (14:17 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 11 Dec 2020 14:17:49 +0000 (14:17 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@20624 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/board.rb

index 9931efb57f0849ecad8238a383c12d77e7c210f8..d9410327e9520e2af90795fec2192afe7e79acc6 100644 (file)
@@ -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)