Module: Notifications::Model::ClassMethods
- Defined in:
- lib/notifications/model.rb
Instance Method Summary collapse
Instance Method Details
#read!(ids = []) ⇒ Object
49 50 51 52 |
# File 'lib/notifications/model.rb', line 49 def read!(ids = []) return if ids.blank? Notification.where(id: ids).update_all(read_at: Time.now) end |
#unread_count(user) ⇒ Object
54 55 56 |
# File 'lib/notifications/model.rb', line 54 def unread_count(user) Notification.where(user: user).unread.count end |