Remove unused code
This commit is contained in:
@@ -8,16 +8,6 @@ module DocumentsHelper
|
|||||||
document.errors[:attachment].join(', ') if document.errors.key?(:attachment)
|
document.errors[:attachment].join(', ') if document.errors.key?(:attachment)
|
||||||
end
|
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)
|
def bytesToMeg(bytes)
|
||||||
bytes / Numeric::MEGABYTE
|
bytes / Numeric::MEGABYTE
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,12 +7,10 @@ class Document < ActiveRecord::Base
|
|||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :documentable, polymorphic: true
|
belongs_to :documentable, polymorphic: true
|
||||||
|
|
||||||
# validates_attachment :attachment, presence: true
|
|
||||||
validate :attachment_presence
|
|
||||||
# validates :attachment_prensence
|
|
||||||
# Disable paperclip security validation due to polymorphic configuration
|
# Disable paperclip security validation due to polymorphic configuration
|
||||||
# Paperclip do not allow to user Procs on valiations definition
|
# Paperclip do not allow to user Procs on valiations definition
|
||||||
do_not_validate_attachment_file_type :attachment
|
do_not_validate_attachment_file_type :attachment
|
||||||
|
validate :attachment_presence
|
||||||
validate :validate_attachment_content_type, if: -> { attachment.present? }
|
validate :validate_attachment_content_type, if: -> { attachment.present? }
|
||||||
validate :validate_attachment_size, if: -> { attachment.present? }
|
validate :validate_attachment_size, if: -> { attachment.present? }
|
||||||
validates :title, presence: true
|
validates :title, presence: true
|
||||||
|
|||||||
Reference in New Issue
Block a user