Initial commit
This commit is contained in:
21
app/models/video_release_confirmation.rb
Normal file
21
app/models/video_release_confirmation.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
class VideoReleaseConfirmation < ApplicationRecord
|
||||
belongs_to :video
|
||||
belongs_to :releasable, polymorphic: true
|
||||
belongs_to :file_info, optional: true
|
||||
|
||||
scope :order_by_ranked_release_type, -> { order(ReleaseRankOrder.new.sql) }
|
||||
|
||||
def appears_at
|
||||
Timecode.from_seconds(time_elapsed.to_f).to_s
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
class ReleaseRankOrder
|
||||
def sql
|
||||
attribute = "releasable_type"
|
||||
types = [TalentRelease, AppearanceRelease, LocationRelease, AcquiredMediaRelease, MaterialRelease, MusicRelease]
|
||||
CustomRankOrder.new(attribute, types).sql
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user