From b7c5853de5f0f04625eab6389cba9de8b02e48fb Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 12 May 2025 14:53:31 -0400 Subject: Added streams index --- app/models/update.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/models/update.rb') 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 validates :stream, :body, presence: true + after_create :set_latest_timestamp + def path "/thinks/#{stream.slug}\#update-#{id}" end @@ -12,4 +14,10 @@ class Update < ApplicationRecord def taggable stream end + + private + def set_latest_timestamp + self.stream.latest_post_at = self.created_at + self.stream.save! + end end -- cgit 1.4.1