|
|
|
@ -127,7 +127,7 @@ class Message < ActiveRecord::Base
|
|
|
|
|
|
|
|
|
|
# 发帖精辟更新发帖总数
|
|
|
|
|
def add_boards_count
|
|
|
|
|
if self.parent_id.nil?
|
|
|
|
|
if self.project && self.parent_id.nil?
|
|
|
|
|
count = self.project.boards_count + 1
|
|
|
|
|
self.project.update_attribute(:boards_count, count)
|
|
|
|
|
end
|
|
|
|
@ -313,7 +313,7 @@ class Message < ActiveRecord::Base
|
|
|
|
|
|
|
|
|
|
# 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少
|
|
|
|
|
def decrease_boards_count
|
|
|
|
|
if self.parent_id.nil?
|
|
|
|
|
if self.project && self.parent_id.nil?
|
|
|
|
|
count = self.project.boards_count - 1
|
|
|
|
|
self.project.update_attribute(:boards_count, count)
|
|
|
|
|
end
|
|
|
|
|