module Notifications::Model::ClassMethods

Public Instance Methods

read!(user, ids = []) click to toggle source
# File lib/notifications/model.rb, line 41
def read!(user, ids = [])
  return if ids.blank?
  Notification.where(user: user, id: ids).update_all(read_at: Time.now)
end
read_count(user) click to toggle source
# File lib/notifications/model.rb, line 50
def read_count(user)
  Notification.where(user: user).read.count
end
unread_count(user) click to toggle source
# File lib/notifications/model.rb, line 46
def unread_count(user)
  Notification.where(user: user).unread.count
end