Class: News

Overview

News News is used to communicate with users of Projects and the Application (Administration).

Direct Known Subclasses

Administration, Project

Defined Under Namespace

Classes: Administration, AdministrationController, Project

Constant Summary collapse

ADMINISTRATION_TYPES =
{
  'News::Administration::BlogPost': :administration_blog_post,
  'News::Administration::Warning': :administration_warning,
  'News::Administration::Notice': :administration_notice,
}.freeze
PROJECT_TYPES =
{
  'News::Project::BlogPost': :blog_post,
  'News::Project::Instruction': :instruction,
  'News::Project::Notice': :notice,
}.freeze

Instance Attribute Summary

Attributes included from Housekeeping::Users

#by

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Shared::HasPapertrail

#attribute_updated, #attribute_updater, #detect_version

Methods included from Shared::Metamorphosize

#metamorphosize

Methods included from Housekeeping::Users

#set_created_by_id, #set_updated_by_id

Methods inherited from ApplicationRecord

transaction_with_retry

Class Method Details

.annotates? ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/models/news.rb', line 41

def self.annotates?
  false
end

Instance Method Details

#display_end_after_display_start ⇒ Object (private)



52
53
54
55
56
57
58
# File 'app/models/news.rb', line 52

def display_end_after_display_start
  return if display_start.nil? || display_end.nil?

  if display_end <= display_start
    errors.add(:display_end, 'must be later than display start')
  end
end

#is_current? ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
48
# File 'app/models/news.rb', line 45

def is_current?
  t = Time.current
  (display_start.nil? or display_start <= t) && (display_end.nil? or display_end >= t)
end