You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
425 B
15 lines
425 B
11 months ago
|
class Notification < ApplicationRecord
|
||
|
acts_as_readable
|
||
|
|
||
|
scope :active, -> { where("start_date <= ? AND end_date >= ?", Time.zone.now, Time.zone.now) }
|
||
|
scope :unauthenticated, -> { where(show_on_unauthenticated_pages: true) }
|
||
|
|
||
|
def self.active_unauthenticated_notifications
|
||
|
active.unauthenticated
|
||
|
end
|
||
|
|
||
|
def self.newest_active_unauthenticated_notification
|
||
|
active_unauthenticated_notifications.last
|
||
|
end
|
||
|
end
|