Sha256: 453f325122f4ecd91f172d7c1fe80c4508e1eafc7ea97daf728b43029bb79874

Contents?: true

Size: 597 Bytes

Versions: 13

Compression:

Stored size: 597 Bytes

Contents

# frozen_string_literal: true
# Defines a relationship between a BitCore::Slideshow and a "target", which for
# now is limited to the home screen of a Participant.
class SlideshowAnchor < ActiveRecord::Base
  TARGET_NAMES = %w(home_intro).freeze

  belongs_to :slideshow,
             class_name: "BitCore::Slideshow",
             foreign_key: :bit_core_slideshow_id

  validates :slideshow, :target_name, presence: true
  validates :target_name, inclusion: { in: TARGET_NAMES }, uniqueness: true

  def self.fetch(target_name)
    find_by_target_name(target_name.to_s).try(:slideshow)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
think_feel_do_engine-3.22.9 app/models/slideshow_anchor.rb
think_feel_do_engine-3.22.8 app/models/slideshow_anchor.rb
think_feel_do_engine-3.22.7 app/models/slideshow_anchor.rb
think_feel_do_engine-3.22.6 app/models/slideshow_anchor.rb
think_feel_do_engine-3.22.5 app/models/slideshow_anchor.rb
think_feel_do_engine-3.22.4 app/models/slideshow_anchor.rb
think_feel_do_engine-3.22.2 app/models/slideshow_anchor.rb
think_feel_do_engine-3.22.1 app/models/slideshow_anchor.rb
think_feel_do_engine-3.22.0 app/models/slideshow_anchor.rb
think_feel_do_engine-3.21.2 app/models/slideshow_anchor.rb
think_feel_do_engine-3.21.1 app/models/slideshow_anchor.rb
think_feel_do_engine-3.21.0 app/models/slideshow_anchor.rb
think_feel_do_engine-3.20.1 app/models/slideshow_anchor.rb