class Communique::Notification

active model definition for notifications

Public Class Methods

count_unseen(notifiable) click to toggle source
# File lib/communique/models/notification.rb, line 25
def self.count_unseen(notifiable)
  notifiable.notifications.where(seen: false).count
end
viewed!(notifiable, seen_notification_ids) click to toggle source
# File lib/communique/models/notification.rb, line 19
def self.viewed!(notifiable, seen_notification_ids)
  notifiable.notifications.where(
    :_id.in => seen_notification_ids
  ).update_all(seen: true)
end
viewed_all!(notifiable) click to toggle source
# File lib/communique/models/notification.rb, line 15
def self.viewed_all!(notifiable)
  notifiable.notifications.update_all(seen: true)
end