fix error

This commit is contained in:
邱博亞 2022-03-24 11:56:25 +08:00
parent 668e38b320
commit 1142ed9ab4
1 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ class AsksController < ApplicationController
ask_question = AskQuestion.new
locale = I18n.locale
ask_settings = AskCategorySetting.where(:category_id.in=> categories.collect{|v| v.id.to_s}).to_a
if ask_settings.count != 0 && ask_settings.count != categories.count
if ask_settings.count != categories.count
ask_settings = [AskSetting.first]+ask_settings
end
ask_setting = AskCategorySetting.where(category_id: categories.first.id.to_s).first
@ -115,7 +115,7 @@ class AsksController < ApplicationController
categories = Array(Category.find(OrbitHelper.page_categories)) rescue ['all']
categories = module_app.categories if categories.include? 'all'
ask_settings = AskCategorySetting.where(:category_id.in=> categories.collect{|v| v.id.to_s}).to_a
if ask_settings.count != 0 && ask_settings.count != categories.count
if ask_settings.count != categories.count
ask_settings = [AskSetting.first]+ask_settings
end
ask_setting = AskCategorySetting.where(category_id: categories.first.id.to_s).first
@ -182,7 +182,7 @@ class AsksController < ApplicationController
end
end
end
flag =(!ask_setting.default_setting['recaptcha'] || gotcha_valid?) && @ask_question.save
flag = !ask_setting.default_setting['recaptcha'] || gotcha_valid?
if flag
all_to_save.each do |to_save|
flag = flag && to_save[1].save