diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-05-12 14:53:31 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-05-12 14:53:31 -0400 |
| commit | b7c5853de5f0f04625eab6389cba9de8b02e48fb (patch) | |
| tree | 1764a974e1b93b024c90f98246590d0bac5430ef /app/models/update.rb | |
| parent | 4016070f2caf30f576d0b0df8a65a7b4b468e951 (diff) | |
| download | thoughts-b7c5853de5f0f04625eab6389cba9de8b02e48fb.tar.gz thoughts-b7c5853de5f0f04625eab6389cba9de8b02e48fb.tar.bz2 thoughts-b7c5853de5f0f04625eab6389cba9de8b02e48fb.zip | |
Added streams index
Diffstat (limited to 'app/models/update.rb')
| -rw-r--r-- | app/models/update.rb | 8 |
1 files changed, 8 insertions, 0 deletions
| diff --git a/app/models/update.rb b/app/models/update.rb index 01907d8..a98a5d4 100644 --- a/app/models/update.rb +++ b/app/models/update.rb | |||
| @@ -5,6 +5,8 @@ class Update < ApplicationRecord | |||
| 5 | 5 | ||
| 6 | validates :stream, :body, presence: true | 6 | validates :stream, :body, presence: true |
| 7 | 7 | ||
| 8 | after_create :set_latest_timestamp | ||
| 9 | |||
| 8 | def path | 10 | def path |
| 9 | "/thinks/#{stream.slug}\#update-#{id}" | 11 | "/thinks/#{stream.slug}\#update-#{id}" |
| 10 | end | 12 | end |
| @@ -12,4 +14,10 @@ class Update < ApplicationRecord | |||
| 12 | def taggable | 14 | def taggable |
| 13 | stream | 15 | stream |
| 14 | end | 16 | end |
| 17 | |||
| 18 | private | ||
| 19 | def set_latest_timestamp | ||
| 20 | self.stream.latest_post_at = self.created_at | ||
| 21 | self.stream.save! | ||
| 22 | end | ||
| 15 | end | 23 | end |
