demarches-normaliennes/app/models/cerfa.rb
2016-05-13 16:08:51 +02:00

21 lines
No EOL
456 B
Ruby

class Cerfa < ActiveRecord::Base
belongs_to :dossier
belongs_to :user
mount_uploader :content, CerfaUploader
validates :content, :file_size => {:maximum => 3.megabytes}
def empty?
content.blank?
end
def content_url
if Features.remote_storage and !content.url.nil?
(RemoteDownloader.new content.filename).url
else
unless content.url.nil?
(LocalDownloader.new content, 'CERFA').url
end
end
end
end