mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 21:21:50 +08:00
13 lines
419 B
Ruby
13 lines
419 B
Ruby
class Notification < ActiveRecord::Base
|
|
has_many :user_notifications, inverse_of: :notification
|
|
has_many :users, through: :user_notifications
|
|
belongs_to :generator_user, class_name: 'User'
|
|
|
|
enum type_of: [:assignment, :recent_changes, :system_message]
|
|
|
|
def already_seen(user)
|
|
UserNotification.where(notification: self, user: user)
|
|
.pluck(:checked)
|
|
.first
|
|
end
|
|
end
|