eremail/app/models/email_er_file.rb

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