Class: ShowcaseDigitalAsset

Inherits:
ApplicationRecord show all
Defined in:
app/models/showcase_digital_asset.rb

Overview

== Schema Information

Table name: showcase_digital_assets
Database name: primary

id :bigint not null, primary key
is_main :boolean default(FALSE), not null
position :integer
digital_asset_id :bigint not null
room_configuration_id :integer
showcase_id :bigint not null

Indexes

idx_sda_showcase_pos (showcase_id,position)
idx_sv2da_digital_asset_id (digital_asset_id)
idx_sv2da_room_configuration_id (room_configuration_id)
idx_unique_main_image_per_showcase_v2 (showcase_id) UNIQUE WHERE (is_main = true)

Foreign Keys

fk_rails_... (digital_asset_id => digital_assets.id)
fk_rails_... (showcase_id => showcases.id)

Constant Summary

Constants included from Schedulable

Schedulable::SIMPLE_FORM_OPTIONS

Instance Attribute Summary collapse

Belongs to collapse

Class Method Summary collapse

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Schedulable

config

Methods included from Models::AfterCommittable

#after_commit

Methods included from Models::EventPublishable

#publish_event

Instance Attribute Details

#is_mainObject (readonly)



87
# File 'app/models/showcase_digital_asset.rb', line 87

validates :is_main, inclusion: { in: [true, false] }

#positionObject (readonly)



81
# File 'app/models/showcase_digital_asset.rb', line 81

validates :position, presence: true, numericality: { greater_than_or_equal_to: 0 }

Class Method Details

.mainActiveRecord::Relation<ShowcaseDigitalAsset>

A relation of ShowcaseDigitalAssets that are main. Active Record Scope

Returns:

See Also:



85
# File 'app/models/showcase_digital_asset.rb', line 85

scope :main, -> { where(is_main: true) }

Instance Method Details

#digital_assetDigitalAsset



79
# File 'app/models/showcase_digital_asset.rb', line 79

belongs_to :digital_asset

#room_configurationRoomConfiguration

Optional link to a room configuration if the image was imported from a specific room

Returns:

  • (RoomConfiguration)

See Also:



83
# File 'app/models/showcase_digital_asset.rb', line 83

belongs_to :room_configuration, optional: true

#showcaseShowcase

Returns:

See Also:



78
# File 'app/models/showcase_digital_asset.rb', line 78

belongs_to :showcase