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)

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 Models::EventPublishable

#publish_event

Instance Attribute Details

#is_mainObject (readonly)



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

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

#positionObject (readonly)



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

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:



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

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

Instance Method Details

#digital_assetDigitalAsset



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

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:



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

belongs_to :room_configuration, optional: true

#showcaseShowcase

Returns:

See Also:



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

belongs_to :showcase