Class: Eventifier::Notification
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Eventifier::Notification
- Defined in:
- app/models/eventifier/notification.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.expire_for_past_events!(time_limit = 1.day.ago) ⇒ Object
22 23 24 |
# File 'app/models/eventifier/notification.rb', line 22 def self.expire_for_past_events!(time_limit = 1.day.ago) self.for_events(Event.expired_ids(time_limit)).each &:expire! end |
.unread_for(user) ⇒ Object
26 27 28 29 30 31 32 |
# File 'app/models/eventifier/notification.rb', line 26 def self.unread_for(user) if user.notifications_last_read_at for_user(user).since(user.notifications_last_read_at) else for_user(user) end end |
Instance Method Details
#unread_for?(user) ⇒ Boolean
34 35 36 37 |
# File 'app/models/eventifier/notification.rb', line 34 def unread_for?(user) return true if user.notifications_last_read_at.nil? created_at > user.notifications_last_read_at end |