persist the default admin set id in the database #5263
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5261
This also makes the default admin set and id accessible through
Hyrax.config
. The first time it is accessed, the default admin set will be created if it doesn’t already exist. If the default admin set id saved in the database changes, it will reset the instance variable inHyrax.config
that caches the default admin set.Final Design
The final design is somewhat different than the one proposed in #5261.
It addresses challenges:
Supporting changes:
Hyrax::DefaultAdministrativeSet
which saves the default admin set id in the databaseHyrax.config.default_admin_set
which caches the default admin set in @default_admin_set instance variable the first time it is accessed. It can be forced to update by callingHyrax.config.reset_default_admin_set.
Hyrax.config.default_admin_set_id` provides a shortcut to the default admin set's id.Hyrax::AdminSetCreateService.find_or_create_default_admin_set
usesHyrax::DefaultAdministrativeSet
to make sure the id is persisted. This maintains this method as "the" way to create the default admin set. Using this method, the persisted and cached versions of the default admin set will be refreshed if needed.@samvera/hyrax-code-reviewers