From a704b6a1fdff90d9a94ef0f348ad0e32809eb4ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sat, 13 Jul 2024 21:33:15 +0800 Subject: [PATCH] Fix show page. --- app/views/event_news_mods/show.html.erb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/event_news_mods/show.html.erb b/app/views/event_news_mods/show.html.erb index 82329e7..f70e658 100644 --- a/app/views/event_news_mods/show.html.erb +++ b/app/views/event_news_mods/show.html.erb @@ -5,12 +5,13 @@ page = Page.where(url:params['url']).first @ad_banner_location = 2 @show_back_and_next_flag = 0 - if page.methods.include? 'select_option_items'.to_sym - ModuleApp.all.select{|tmp| tmp.key.to_s=='event_news'}.each do |module_app| - @show_option_items = module_app.show_option_items rescue nil + if Page.instance_methods.include?(:select_option_items) && ModuleApp.instance_methods.include?(:show_option_items) + @show_option_items = nil + ModuleApp.all.select{|tmp| tmp.key.to_s=='event_news_mod'}.each do |module_app| + @show_option_items = module_app.show_option_items end page.select_option_items.each do |select_option_item| - if !(@show_option_items.nil?) + unless @show_option_items.nil? if select_option_item.field_name == @show_option_items.keys.first.to_s value = YAML.load(select_option_item.value) tmp = value[:en]