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 %>