diff --git a/app/models/email_er_file.rb b/app/models/email_er_file.rb index 079d9e7..d13585c 100644 --- a/app/models/email_er_file.rb +++ b/app/models/email_er_file.rb @@ -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 diff --git a/app/views/admin/er_emails/_form.html.erb b/app/views/admin/er_emails/_form.html.erb index e973fef..4085e58 100644 --- a/app/views/admin/er_emails/_form.html.erb +++ b/app/views/admin/er_emails/_form.html.erb @@ -92,6 +92,8 @@