24 lines
362 B
Ruby
24 lines
362 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.file.size > 10.megabytes
|
|
errors.add( :file, I18n.t("er_email.email_file_limit"))
|
|
end
|
|
end
|
|
|
|
end
|