From accc38f708dde6e5ef5d79af6c7aff9d874a6cee Mon Sep 17 00:00:00 2001 From: Audrey Hamelers Date: Tue, 30 Jul 2024 19:27:05 +0200 Subject: [PATCH] allow creation of resource publication when one does not yet exist --- app/controllers/stash_engine/admin_datasets_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/stash_engine/admin_datasets_controller.rb b/app/controllers/stash_engine/admin_datasets_controller.rb index 72394807d..787c67eb8 100644 --- a/app/controllers/stash_engine/admin_datasets_controller.rb +++ b/app/controllers/stash_engine/admin_datasets_controller.rb @@ -59,7 +59,7 @@ def popup ) when 'publication' authorize %i[stash_engine admin_datasets], :data_popup? - @publication = StashEngine::ResourcePublication.find_or_initialize_by(resource_id: @identifier.latest_resource.id) + @publication = StashEngine::ResourcePublication.find_or_create_by(resource_id: @identifier.latest_resource.id) when 'data' authorize %i[stash_engine admin_datasets], :data_popup? setup_internal_data_list