From bf2175dec7eeb32dcaf8d5c11fddb7f3b24fcd68 Mon Sep 17 00:00:00 2001 From: LaRita Robinson Date: Mon, 17 Nov 2025 17:01:33 -0500 Subject: [PATCH] Redefine valid_child_concerns A class's valid_child_concerns are redefined to only include registered concerns. Ensure that only the registered concerns can be nested within each other Hyrax::NestedWorks loads the valid_child_concerns prior to the above configuration This removes Hyku's default work types from the list of valid child concerns --- config/initializers/hyrax.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/initializers/hyrax.rb b/config/initializers/hyrax.rb index e12c0fa..8574506 100644 --- a/config/initializers/hyrax.rb +++ b/config/initializers/hyrax.rb @@ -23,4 +23,11 @@ # Injected via `rails g hyku_knapsack:work_resource OralHistory --flexible` config.register_curation_concern :oral_history end + + # Ensure that only the registered concerns can be nested within each other + # Hyrax::NestedWorks loads the valid_child_concerns prior to the above configuration + # This removes Hyku's default work types from the list of valid child concerns + Hyrax.config.curation_concerns.each do |concern| + concern.valid_child_concerns = Hyrax.config.curation_concerns + end end