Files
terminus/app/relations/screen.rb
T
Brooke Kuhlmann 71ddef1b1a Updated screen relation to belong to a template
As done with templates having many screens, this allows a screen to belong to a template which completes the association.

Issue: 321
Milestone: minor
2026-06-22 11:54:10 -06:00

20 lines
598 B
Ruby

# frozen_string_literal: true
module Terminus
module Relations
# The screen relation.
class Screen < DB::Relation
schema :screen, infer: true do
associations do
belongs_to :model, relation: :model
belongs_to :template, relation: :screen_template
has_many :playlist_items, relation: :playlist_item, as: :playlist_items, view: :ordered
has_many :playlists, through: :playlist_item, relation: :playlist, as: :playlists
end
end
def ordered = select_append(playlist_item[:position]).order :position
end
end
end