Hide implementation detail of reading

This commit is contained in:
David Heinemeier Hansson
2025-04-16 16:41:22 +02:00
parent 91194d1b66
commit 4bb9085737
2 changed files with 5 additions and 1 deletions
@@ -1,7 +1,7 @@
class Notifications::ReadingsController < ApplicationController
def create
@notification = Current.user.notifications.find(params[:id])
@notification.update!(read_at: Time.current)
@notification.read
end
def create_all
+4
View File
@@ -15,6 +15,10 @@ class Notification < ApplicationRecord
update!(read_at: Time.current)
end
def read
update!(read_at: Time.current)
end
def read?
read_at.present?
end