Remove unused code

This commit is contained in:
Senén Rodero Rodríguez
2017-08-25 19:14:15 +02:00
parent b0e4c5d66c
commit 57930df535
2 changed files with 1 additions and 13 deletions

View File

@@ -8,16 +8,6 @@ module DocumentsHelper
document.errors[:attachment].join(', ') if document.errors.key?(:attachment)
end
def document_source_options
Hash[Document.sources.map { |k,v| [k, Document.human_attribute_name("document.#{k}")] }]
end
def document_link_url(document)
uri = URI.parse(document.link)
return document.link if uri.scheme == "http" || uri.scheme == "https"
"http://#{document.link}"
end
def bytesToMeg(bytes)
bytes / Numeric::MEGABYTE
end

View File

@@ -7,12 +7,10 @@ class Document < ActiveRecord::Base
belongs_to :user
belongs_to :documentable, polymorphic: true
# validates_attachment :attachment, presence: true
validate :attachment_presence
# validates :attachment_prensence
# Disable paperclip security validation due to polymorphic configuration
# Paperclip do not allow to user Procs on valiations definition
do_not_validate_attachment_file_type :attachment
validate :attachment_presence
validate :validate_attachment_content_type, if: -> { attachment.present? }
validate :validate_attachment_size, if: -> { attachment.present? }
validates :title, presence: true