29 lines
579 B
Ruby
29 lines
579 B
Ruby
# -*- encoding : utf-8 -*-
|
|
class Prescription < ActiveRecord::Base
|
|
|
|
mount_uploader :file, PrescriptionUploader
|
|
|
|
attr_accessor :email
|
|
attr_accessible :email, :tel, :name, :notes, :file, :pharma_notes, :done_by, :read, :done_at, :delivery_at, :done
|
|
|
|
|
|
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
|