demarches-normaliennes/app/models/cerfa.rb

21 lines
443 B
Ruby
Raw Normal View History

2015-08-18 13:52:00 +02:00
class Cerfa < ActiveRecord::Base
belongs_to :dossier
belongs_to :user
2015-08-18 13:52:00 +02:00
mount_uploader :content, CerfaUploader
validates :content, :file_size => {:maximum => 3.megabytes}
2015-08-18 16:30:57 +02:00
def empty?
content.blank?
end
def content_url
2016-05-18 11:43:32 +02:00
unless content.url.nil?
if Features.remote_storage
(RemoteDownloader.new content.filename).url
else
2016-05-24 18:35:25 +02:00
(LocalDownloader.new content.path, 'CERFA').url
end
end
end
2015-08-18 13:52:00 +02:00
end