Module: Notifications::Model::ClassMethods
- Defined in:
- lib/notifications/model.rb
Instance Method Summary collapse
Instance Method Details
#read!(user, ids = []) ⇒ Object
41 42 43 44 |
# 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) ⇒ Object
50 51 52 |
# File 'lib/notifications/model.rb', line 50 def read_count(user) Notification.where(user: user).read.count end |
#unread_count(user) ⇒ Object
46 47 48 |
# File 'lib/notifications/model.rb', line 46 def unread_count(user) Notification.where(user: user).unread.count end |