Class: OtuPageLayout

Inherits:
ApplicationRecord show all
Includes:
Housekeeping, Shared::IsData
Defined in:
app/models/otu_page_layout.rb

Overview

An OtuPageLayout defines the (gross) content and presentation order of an OTU page. Within an otu page layout you may select any number of Topics, or dynamically generate report types. Each section will be filled with content for a particular OTU when the layout is selected for that OTU.

Instance Attribute Summary collapse

Method Summary

Methods included from Shared::IsData

#errors_excepting, #full_error_messages_excepting, #identical, #is_community?, #is_destroyable?, #is_editable?, #is_in_use?, #is_in_users_projects?, #metamorphosize, #similar

Methods included from Housekeeping

#has_polymorphic_relationship?

Methods inherited from ApplicationRecord

transaction_with_retry

Instance Attribute Details

#nameString

Returns The name of the layout.

Returns:

  • (String)

    The name of the layout



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

class OtuPageLayout < ApplicationRecord
  include Housekeeping
  include Shared::IsData

  has_many :otu_page_layout_sections, -> { order(:position) }, inverse_of: :otu_page_layout, dependent: :destroy
  has_many :standard_sections, -> { order(:position) }, class_name: 'OtuPageLayoutSection::StandardSection', inverse_of: :otu_page_layout, dependent: :destroy

  has_many :topics, through: :standard_sections

  accepts_nested_attributes_for :otu_page_layout_sections, allow_destroy: true
  accepts_nested_attributes_for :standard_sections, allow_destroy: true

  validates_presence_of :name
  validates_uniqueness_of :name, scope: [:project_id]
end

#project_idInteger

the project ID

Returns:

  • (Integer)


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

class OtuPageLayout < ApplicationRecord
  include Housekeeping
  include Shared::IsData

  has_many :otu_page_layout_sections, -> { order(:position) }, inverse_of: :otu_page_layout, dependent: :destroy
  has_many :standard_sections, -> { order(:position) }, class_name: 'OtuPageLayoutSection::StandardSection', inverse_of: :otu_page_layout, dependent: :destroy

  has_many :topics, through: :standard_sections

  accepts_nested_attributes_for :otu_page_layout_sections, allow_destroy: true
  accepts_nested_attributes_for :standard_sections, allow_destroy: true

  validates_presence_of :name
  validates_uniqueness_of :name, scope: [:project_id]
end