We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a29b98 commit 7960134Copy full SHA for 7960134
app/models/message.rb
@@ -10,6 +10,8 @@ class Message < ApplicationRecord
10
# https://blade.ruby-lang.org/ruby-talk/410000 is not.
11
self.skip_time_zone_conversion_for_attributes = [:published_at]
12
13
+ attr_accessor :children
14
+
15
class << self
16
def from_mail(mail, list, list_seq)
17
body = Kconv.toutf8 mail.body.raw_source
@@ -85,6 +87,10 @@ def from_string(str)
85
87
end
86
88
89
90
+ def count_recursively(count = 0)
91
+ count + 1 + (children&.sum(&:count_recursively) || 0)
92
+ end
93
94
def reload_from_s3(s3_client = Aws::S3::Client.new(region: BLADE_BUCKET_REGION))
95
m = Message.from_s3(List.find_by_id(self.list_id).name, self.list_seq, s3_client)
96
0 commit comments