diff options
author | slice <ryaneft@gmail.com> | 2019-03-31 22:30:46 -0700 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2019-04-01 07:30:46 +0200 |
commit | 85973f4f37c8b94422f267654018d0d7f88ba32b (patch) | |
tree | 76aa1adb9f7543f68af7f1dbeb735386e5c03a97 /app/models/form | |
parent | abdf225353dfb9791933b5d2dbcd038dcdb656df (diff) |
Improvements to image upload validation and creation (#10431)
* Check if image value is nil? before creating an image Check if uploaded images aren't nil before creating SiteUpload models for them. * Validate presence of file in SiteUpload * Fix file presence validation * Fabricate SiteUpload#file * Add link to Creative Commons license
Diffstat (limited to 'app/models/form')
-rw-r--r-- | app/models/form/admin_settings.rb | 2 |
1 files changed, 1 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 |