Module: Notifications::Model::ClassMethods
- Defined in:
- lib/notifications/model.rb
Instance Method Summary collapse
Instance Method Details
#read!(ids = []) ⇒ Object
40 41 42 43 |
# File 'lib/notifications/model.rb', line 40 def read!(ids = []) return if ids.blank? Notification.where(id: ids).update_all(read_at: Time.now) end |
#unread_count(user) ⇒ Object
45 46 47 |
# File 'lib/notifications/model.rb', line 45 def unread_count(user) Notification.where(user: user).unread.count end |