From bf0f561c2efb45c97112c16a03af84630c79943b Mon Sep 17 00:00:00 2001 From: chiu Date: Tue, 5 Nov 2019 21:21:00 +0800 Subject: [PATCH] fix error --- app/controllers/admin/galleries_controller.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/controllers/admin/galleries_controller.rb b/app/controllers/admin/galleries_controller.rb index e340568..2211f36 100644 --- a/app/controllers/admin/galleries_controller.rb +++ b/app/controllers/admin/galleries_controller.rb @@ -41,6 +41,9 @@ class Admin::GalleriesController < OrbitAdminController end end variable = AlbumVariable.first + if variable.nil? + variable = AlbumVariable.new + end variable.finish = false variable.save! Thread.new do @@ -84,6 +87,9 @@ class Admin::GalleriesController < OrbitAdminController if notalive if !params['album_id'].to_s.empty? variable = AlbumVariable.first + if variable.nil? + variable = AlbumVariable.new + end variable.finish = false variable.save! choice_ids = params['album_id'].split(',') @@ -392,6 +398,9 @@ class Admin::GalleriesController < OrbitAdminController end def init_upload variable = AlbumVariable.first + if variable.nil? + variable = AlbumVariable.new + end variable.count = params['all_length'].to_i variable.finish = false variable.progress_percent = '0%'