Module: ApplicationAnnouncementsConcern

Extended by:
ActiveSupport::Concern
Included in:
ApplicationController
Defined in:
app/controllers/concerns/application_announcements_concern.rb

Instance Method Summary collapse

Instance Method Details

#global_announcementsArray<GenericAnnouncement>

Returns all active global announcements.

Returns:


15
16
17
# File 'app/controllers/concerns/application_announcements_concern.rb', line 15

def global_announcements
  GenericAnnouncement.for_instance(current_tenant).currently_active
end

#unread_global_announcementsArray<GenericAnnouncement>

Returns active global announcements unread by the current user, if one is signed in.

Returns:


8
9
10
# File 'app/controllers/concerns/application_announcements_concern.rb', line 8

def unread_global_announcements
  user_signed_in? ? global_announcements.unread_by(current_user) : global_announcements
end