24 lines
371 B
Ruby
24 lines
371 B
Ruby
|
class EmailErFile
|
||
|
|
||
|
include Mongoid::Document
|
||
|
include Mongoid::Timestamps
|
||
|
|
||
|
mount_uploader :file, AssetUploader
|
||
|
|
||
|
field :should_destroy, :type => Boolean
|
||
|
field :title
|
||
|
|
||
|
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
|