fix error

This commit is contained in:
chiu 2020-08-21 19:06:13 +08:00
parent 7b0f6ddd10
commit f2a0d1ca71
1 changed files with 2 additions and 3 deletions

View File

@ -277,9 +277,7 @@ class Admin::AsksController < OrbitAdminController
ask_setting = AskSetting.create() if ask_setting.nil?
end
if temp_params['custom_values'].nil?
temp_params['custom_values'] = @ask_question.custom_values
else
temp_params['custom_values'] = @ask_question.custom_values.merge(temp_params['custom_values'])
temp_params['custom_values'] = {}
end
ask_setting.custom_fields.select{|k,v| v['type']=='file' || v['type']=='image'}.each do |k,v|
file = temp_params['custom_values'][k] rescue nil
@ -293,6 +291,7 @@ class Admin::AsksController < OrbitAdminController
temp_params['custom_values'][k] = @ask_question.custom_values[k] rescue nil
end
end
temp_params['custom_values'] = @ask_question.custom_values.merge(temp_params['custom_values'])
flag = @ask_question.save
if flag
all_to_save.each do |to_save|