about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/form/admin_settings.rb2
-rw-r--r--app/models/site_upload.rb1
2 files changed, 2 insertions, 1 deletions
diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb
index 85a6e6dff..d3af8c30f 100644
--- a/app/models/form/admin_settings.rb
+++ b/app/models/form/admin_settings.rb
@@ -67,7 +67,7 @@ class Form::AdminSettings
     KEYS.each do |key|
       value = instance_variable_get("@#{key}")
 
-      if UPLOAD_KEYS.include?(key)
+      if UPLOAD_KEYS.include?(key) && !value.nil?
         upload = SiteUpload.where(var: key).first_or_initialize(var: key)
         upload.update(file: value)
       else
diff --git a/app/models/site_upload.rb b/app/models/site_upload.rb
index 14d683767..cf10b30fc 100644
--- a/app/models/site_upload.rb
+++ b/app/models/site_upload.rb
@@ -18,6 +18,7 @@ class SiteUpload < ApplicationRecord
   has_attached_file :file
 
   validates_attachment_content_type :file, content_type: /\Aimage\/.*\z/
+  validates :file, presence: true
   validates :var, presence: true, uniqueness: true
 
   before_save :set_meta