From b790b157a292e8ea1a95ef790bb065556c93cee5 Mon Sep 17 00:00:00 2001 From: balen Date: Tue, 23 Jan 2024 16:11:56 -0500 Subject: [PATCH] set a sort order on add field --- app/controllers/admin/field_groups_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/field_groups_controller.rb b/app/controllers/admin/field_groups_controller.rb index 0562e03c..45b008ab 100755 --- a/app/controllers/admin/field_groups_controller.rb +++ b/app/controllers/admin/field_groups_controller.rb @@ -172,7 +172,11 @@ def add_to_page_type @page_type = PageType.find params[:page_type_id] @field_group = FieldGroup.find params[:field_group_id] - ptfg = PageTypesFieldGroup.create!(page_type_id: params[:page_type_id], field_group_id: params[:field_group_id]) + ptfg = PageTypesFieldGroup.create!( + page_type_id: params[:page_type_id], + field_group_id: params[:field_group_id], + sort_order: 0 + ) # raise ptfg.errors.full_messages.join("
") if ptfg.errors.any? rescue => ex Rails.logger.error ex.message