Class: Document

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
CommonScopes
Defined in:
app/models/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CommonScopes

included

Instance Attribute Details

#filearraysObject

Returns the value of attribute filearrays


17
18
19
# File 'app/models/document.rb', line 17

def filearrays
  @filearrays
end

Instance Method Details

#not_blacklisted_fileObject


25
26
27
28
29
30
31
# File 'app/models/document.rb', line 25

def not_blacklisted_file
  forbiden_types = %w(ade adp bat chm cmd com cpl dll exe hta ins isp jse lib mde msc msp mst pif scr sct shb sys vb vbe vbs vxd wsc wsf wsh css javascript)
  
  extension = document_content_type.split('/').last

  errors.add(:document,'FORBIDEN FILE EXTENSION: ' + extension) if forbiden_types.include?(extension) 
end