From 200cfd59d36a186c86e64389f953c08cce4df36c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Fri, 23 Aug 2024 21:42:21 +0800 Subject: [PATCH] Fix bug. --- .../admin/hnc_cancer_predicts_controller.rb | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/app/controllers/admin/hnc_cancer_predicts_controller.rb b/app/controllers/admin/hnc_cancer_predicts_controller.rb index a0e125c..3e75c85 100644 --- a/app/controllers/admin/hnc_cancer_predicts_controller.rb +++ b/app/controllers/admin/hnc_cancer_predicts_controller.rb @@ -343,14 +343,12 @@ class Admin::HncCancerPredictsController < OrbitAdminController @index += 1 end end - Dir.chdir("public") do - @site_locales = Site.last.in_use_locales.each do |locale| - I18n.with_locale(locale) do - @file_tmp = File.new(HncCancerPredictfields::ToolTableMap[I18n.locale], "w") - tmp_table_texts = create_table(locale) - @file_tmp.write(tmp_table_texts) - @file_tmp.close - end + @site_locales = Site.last.in_use_locales.each do |locale| + I18n.with_locale(locale) do + @file_tmp = File.new(HncCancerPredictfields::ToolTableMap[I18n.locale], "w") + tmp_table_texts = create_table(locale) + @file_tmp.write(tmp_table_texts) + @file_tmp.close end end Dir.chdir("public") do @@ -671,14 +669,12 @@ class Admin::HncCancerPredictsController < OrbitAdminController @form_to_show.title = @app_title @form_to_show.save @form_to_show = HncCancerPredictfields.where("title" => @app_title).first - Dir.chdir("public") do - @site_locales = Site.last.in_use_locales.each do |locale| - I18n.with_locale(locale) do - @file_tmp = File.new(HncCancerPredictfields::ToolTableMap[I18n.locale], "w") - tmp_table_texts = create_table(locale) - @file_tmp.write(tmp_table_texts) - @file_tmp.close - end + @site_locales = Site.last.in_use_locales.each do |locale| + I18n.with_locale(locale) do + @file_tmp = File.new(HncCancerPredictfields::ToolTableMap[I18n.locale], "w") + tmp_table_texts = create_table(locale) + @file_tmp.write(tmp_table_texts) + @file_tmp.close end end else