diff --git a/app/controllers/notifications/readings_controller.rb b/app/controllers/notifications/readings_controller.rb index 3c1c47c1a..5f593fa95 100644 --- a/app/controllers/notifications/readings_controller.rb +++ b/app/controllers/notifications/readings_controller.rb @@ -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 diff --git a/app/models/notification.rb b/app/models/notification.rb index d4ea87a95..617b2c0d4 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -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