dawarich/app/models/notification.rb

16 lines
280 B
Ruby
Raw Normal View History

2024-07-04 16:20:12 -04:00
# frozen_string_literal: true
class Notification < ApplicationRecord
belongs_to :user
validates :title, :content, :kind, presence: true
2024-09-05 15:01:59 -04:00
enum :kind, { info: 0, warning: 1, error: 2 }
2024-07-04 16:20:12 -04:00
scope :unread, -> { where(read_at: nil) }
2024-09-08 10:52:35 -04:00
def read?
read_at.present?
end
2024-07-04 16:20:12 -04:00
end