eremail/app/models/email_er_file.rb

26 lines
396 B
Ruby
Raw Normal View History

2014-07-16 08:32:50 +00:00
# encoding: utf-8
class EmailErFile
include Mongoid::Document
include Mongoid::Timestamps
mount_uploader :file, AssetUploader
field :title, localize: true
belongs_to :email_er
validate :file_size
private
def file_size
2014-10-06 06:35:40 +00:00
if !file.blank?
if file.file.size > 10.megabytes
errors.add( :file, I18n.t("er_email.email_file_limit"))
end
2014-07-16 08:32:50 +00:00
end
end
end