Class: Postablr::Entry::Audio

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/postablr/entry/audio.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#content_typeObject

Returns the value of attribute content_type.



7
8
9
# File 'app/models/postablr/entry/audio.rb', line 7

def content_type
  @content_type
end

#filenameObject

Returns the value of attribute filename.



7
8
9
# File 'app/models/postablr/entry/audio.rb', line 7

def filename
  @filename
end

#sizeObject

Returns the value of attribute size.



7
8
9
# File 'app/models/postablr/entry/audio.rb', line 7

def size
  @size
end

Instance Method Details

#audio_titleObject



19
20
21
# File 'app/models/postablr/entry/audio.rb', line 19

def audio_title
  title.blank? ? File.basename( file.url ) : title
end

#path=(value) ⇒ Object

validates_presence_of :title



11
12
13
14
15
16
17
# File 'app/models/postablr/entry/audio.rb', line 11

def path=(value)
  logger.info value
  uploaded_file = CarrierWave::SanitizedFile.new :tempfile => value,
  :filename => filename,
  :content_type => content_type
  self.file = uploaded_file
end