Class: Video

Inherits:
Object
  • Object
show all
Includes:
Ish::Utils, Mongoid::Document, Mongoid::Paperclip, Mongoid::Paranoia, Mongoid::Timestamps, Mongoid::Votable
Defined in:
lib/video.rb

Constant Summary collapse

PER_PAGE =
6

Constants included from Mongoid::Votable

Mongoid::Votable::VOTE_POINT

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mongoid::Votable

#down_voter_ids, #down_votes_count, #up_voter_ids, #up_votes_count, #vote, #vote_value, #votes_count, #votes_point

Methods included from Ish::Utils

#export

Class Method Details

.listObject



44
45
46
# File 'lib/video.rb', line 44

def self.list
  [['', nil]] + Video.unscoped.order_by( :created_at => :desc ).map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
end

Instance Method Details

#export_fieldsObject



86
87
88
# File 'lib/video.rb', line 86

def export_fields
  %w| name descr |
end

#is_premiumObject



80
81
82
# File 'lib/video.rb', line 80

def is_premium
  premium_tier > 0
end

#is_trashObject



22
23
24
25
26
27
28
# File 'lib/video.rb', line 22

def is_trash
  if deleted_at
    true
  else
    self[:is_trash]
  end
end

#premium?Boolean

Returns:

  • (Boolean)


83
# File 'lib/video.rb', line 83

def premium?; is_premium; end

#premium_tierObject

copy-paste



79
# File 'lib/video.rb', line 79

field :premium_tier, type: Integer, default: 0

#subheadObject

still need it… 2023-03-24



19
# File 'lib/video.rb', line 19

field :subhead