Class: SerialChronology

Inherits:
ApplicationRecord show all
Includes:
Housekeeping::Timestamps, Housekeeping::Users, Shared::IsData, Shared::SharedAcrossProjects
Defined in:
app/models/serial_chronology.rb

Overview

Stores the chronological relationship between two serials.

Direct Known Subclasses

SerialMerge, SerialSequence

Defined Under Namespace

Classes: SerialMerge, SerialSequence

Instance Attribute Summary (collapse)

Attributes included from Housekeeping::Users

#by

Method Summary

Methods included from Housekeeping::Timestamps

#data_breakdown_for_chartkick_recent

Methods included from Housekeeping::Users

#set_created_by_id, #set_updated_by_id

Instance Attribute Details

- (Integer) preceding_serial_id

Returns the reference/historical serial

Returns:

  • (Integer)

    the reference/historical serial



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/models/serial_chronology.rb', line 15

class SerialChronology < ApplicationRecord
  include Housekeeping::Users
  include Housekeeping::Timestamps
  include Shared::IsData
  include Shared::SharedAcrossProjects

  belongs_to :preceding_serial, class_name: "Serial", foreign_key: :preceding_serial_id
  belongs_to :succeeding_serial, class_name: "Serial", foreign_key: :succeeding_serial_id

  validates :preceding_serial, presence: true
  validates :succeeding_serial, presence: true
  validates_presence_of :type
end

- (Integer) succeeding_serial_id

Returns the “new” serial

Returns:

  • (Integer)

    the “new” serial



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/models/serial_chronology.rb', line 15

class SerialChronology < ApplicationRecord
  include Housekeeping::Users
  include Housekeeping::Timestamps
  include Shared::IsData
  include Shared::SharedAcrossProjects

  belongs_to :preceding_serial, class_name: "Serial", foreign_key: :preceding_serial_id
  belongs_to :succeeding_serial, class_name: "Serial", foreign_key: :succeeding_serial_id

  validates :preceding_serial, presence: true
  validates :succeeding_serial, presence: true
  validates_presence_of :type
end

- (String) type

Returns the type of transition b/w the old and new

Returns:

  • (String)

    the type of transition b/w the old and new



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/models/serial_chronology.rb', line 15

class SerialChronology < ApplicationRecord
  include Housekeeping::Users
  include Housekeeping::Timestamps
  include Shared::IsData
  include Shared::SharedAcrossProjects

  belongs_to :preceding_serial, class_name: "Serial", foreign_key: :preceding_serial_id
  belongs_to :succeeding_serial, class_name: "Serial", foreign_key: :succeeding_serial_id

  validates :preceding_serial, presence: true
  validates :succeeding_serial, presence: true
  validates_presence_of :type
end