Module: Zencodable::ClassMethods

Defined in:
lib/zencodable.rb

Instance Method Summary collapse

Instance Method Details

#has_video_encodings(target_association, options = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/zencodable.rb', line 14

def has_video_encodings target_association, options = {}
  self.encoding_options = options
  self.encoder_output_files_association = target_association

  has_many self.encoder_output_files_association, :dependent => :destroy

  unless options[:thumbnails].blank?
    self.encoder_thumbnails_association = "#{target_association.to_s.singularize}_thumbnails".to_sym
    has_many self.encoder_thumbnails_association, :dependent => :destroy
  end

  before_save :create_job

  # TODO cleanup
  #before_destroy :prepare_for_destroy
  #after_destroy :destroy_attached_files
end