Skip to content

Commit 050cd40

Browse files
authored
Merge pull request #90 from amatsuda/yyyymm
Pre-compute yyyymm and store the value in DB
2 parents 95efa95 + 9640ff2 commit 050cd40

File tree

3 files changed

+24
-16
lines changed

3 files changed

+24
-16
lines changed

app/models/message.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def from_mail(mail, list, list_seq)
6363
end
6464
end
6565

66+
self.yyyymm = self.published_at.strftime('%Y%m')
67+
6668
self
6769
end
6870

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddYyyymmToMessages < ActiveRecord::Migration[8.1]
2+
def change
3+
add_column :messages, :yyyymm, :integer
4+
end
5+
end

db/schema.rb

Lines changed: 17 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)