26 lines
396 B
Ruby
26 lines
396 B
Ruby
# 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
|
|
if !file.blank?
|
|
if file.file.size > 10.megabytes
|
|
errors.add( :file, I18n.t("er_email.email_file_limit"))
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|