25 lines
434 B
Ruby
25 lines
434 B
Ruby
# -*- encoding : utf-8 -*-
|
|
class Prescription < ActiveRecord::Base
|
|
|
|
mount_uploader :file, PrescriptionUploader
|
|
|
|
validates :name, :presence => true
|
|
validates :tel, :presence => true
|
|
|
|
|
|
DONE_BYS = [["GB",1],["MB",2],["VB",3],["MV",4],["EA",5],["PG",6]]
|
|
|
|
def file_type
|
|
|
|
|
|
mime = `file --mime -br "#{self.file.path}"`.strip.split(';')[0]
|
|
mime
|
|
|
|
end
|
|
|
|
def is_pdf?
|
|
true if self.file_type == "application/pdf"
|
|
end
|
|
|
|
end
|