Class: GenericAnnouncement

Inherits:
ApplicationRecord show all
Includes:
AnnouncementConcern
Defined in:
app/models/generic_announcement.rb

Overview

Represents a generic announcement, which may be either a system-level or instance-level one.

This is the abstract single-table inheritance table used for both announcement types.

Direct Known Subclasses

Instance::Announcement, System::Announcement

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.for_instance(instance) ⇒ Object

Returns the announcements for the specified +instance+. This would include both global and instance-level announcements.


25
# File 'app/models/generic_announcement.rb', line 25

scope :for_instance, ->(instance) { with_instance([nil, instance]) }

.system_announcements_firstObject

Orders the results such that system announcements appear earlier in the result set.


14
# File 'app/models/generic_announcement.rb', line 14

scope :system_announcements_first, -> { order(instance_id: :desc) }

.with_instance(instance) ⇒ Object

Returns the announcements which belong to the specified +instance+


19
# File 'app/models/generic_announcement.rb', line 19

scope :with_instance, ->(instance) { where(instance: instance) }

Instance Method Details

#sticky?Boolean


29
30
31
# File 'app/models/generic_announcement.rb', line 29

def sticky?
  false
end