From de407b718f41c3740c357e0b989da72214948061 Mon Sep 17 00:00:00 2001 From: rulingcom Date: Thu, 15 May 2025 23:34:30 +0800 Subject: [PATCH] fixes --- app/models/curation_post_section.rb | 7 ++++++- app/views/admin/curations/_form_section_post.html.erb | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/models/curation_post_section.rb b/app/models/curation_post_section.rb index a3e648e..e168da3 100644 --- a/app/models/curation_post_section.rb +++ b/app/models/curation_post_section.rb @@ -7,7 +7,12 @@ class CurationPostSection field :section_type field :text, localize: true field :universal_table - field :table_entries, type: Array, default: [] + field :table_entries belongs_to :curation_post + + def get_table_entries + tids = self.table_entries.split(',') + TableEntry.find(tids) + end end diff --git a/app/views/admin/curations/_form_section_post.html.erb b/app/views/admin/curations/_form_section_post.html.erb index d42530a..47299f1 100644 --- a/app/views/admin/curations/_form_section_post.html.erb +++ b/app/views/admin/curations/_form_section_post.html.erb @@ -38,7 +38,7 @@ <%= t("curation.section_type") %> <%= f.select :section_type, CurationPost::SECTION_TYPES.map { |type| [t("curation.#{type}"), type] }, - { include_blank: t("curation.please_select") }, + { include_blank: t("curation.please_select"), selected: form_section_post.section_type }, class: 'form-control' %> @@ -55,7 +55,7 @@ <% if defined? UniversalTable %>