class ContactFile < ActiveRecord::Base mount_uploader :file, ContactFileUploader belongs_to :admin belongs_to :contact def file_type mime = `file --mime -br "#{self.file.path}"`.strip.split(';')[0] mime end end