Class: Attachment

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/attachment.rb

Direct Known Subclasses

Audio, Avatar, Doc, Media, Pdf, Picture, Video

Instance Method Summary collapse

Instance Method Details

#file_typeObject



29
30
31
# File 'app/models/attachment.rb', line 29

def file_type
  content_type.split('/').last
end

#fill_blank_name_with_filenameObject



33
34
35
36
37
# File 'app/models/attachment.rb', line 33

def fill_blank_name_with_filename
  if name.blank? and filename
    self.name = filename.split('.').first
  end
end