update file upload validate

This commit is contained in:
spen 2014-10-06 14:35:40 +08:00
parent ed30fda285
commit 981abf2a3d
2 changed files with 6 additions and 2 deletions

View File

@ -15,8 +15,10 @@ class EmailErFile
private
def file_size
if file.file.size > 10.megabytes
errors.add( :file, I18n.t("er_email.email_file_limit"))
if !file.blank?
if file.file.size > 10.megabytes
errors.add( :file, I18n.t("er_email.email_file_limit"))
end
end
end

View File

@ -92,6 +92,8 @@
<label class="control-label muted"><%= t(:file_) %></label>
<div class="controls">
<%= t("er_email.email_file_limit") %>
<!-- Exist -->
<% if @email_er && !@email_er.email_er_files.blank? %>
<div class="exist">