Class: Gaggle::Notification
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Gaggle::Notification
- Defined in:
- app/models/gaggle/notification.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.for_messageable(messageable) ⇒ Object
42 43 44 |
# File 'app/models/gaggle/notification.rb', line 42 def () where(messageable_id: .id, messageable_type: .class.name) end |
.messageables ⇒ Object
34 35 36 |
# File 'app/models/gaggle/notification.rb', line 34 def preload(:messageable).map(&:messageable) end |
.unread ⇒ Object
38 39 40 |
# File 'app/models/gaggle/notification.rb', line 38 def unread where(read_at: nil) end |
Instance Method Details
#mark_read! ⇒ Object
18 19 20 |
# File 'app/models/gaggle/notification.rb', line 18 def mark_read! update(read_at: Time.current) end |
#notify_goose ⇒ Object
13 14 15 16 |
# File 'app/models/gaggle/notification.rb', line 13 def notify_goose update(delivered_at: Time.current) goose.(notification: self) end |