You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Hyrax v5, the default for Hyrax.config.collection_model changed from '::Collection' to 'Hyrax::PcdmCollection' (https://github.com/samvera/hyrax/blob/main/lib/hyrax/configuration.rb#L898). This should be able to be overridden by setting Hyrax.config.collection_model = '::Collection' in a Hyrax initializer. Unfortunately, Hyrax::Forms::CollectionForm.model_class seems to be initialized before configuration takes place (https://github.com/samvera/hyrax/blob/main/app/forms/hyrax/forms/collection_form.rb#L19), causing a default of Hyrax::PcdmCollection to persist in Hyrax::Forms::CollectionForm.model_class when interacting with any CollectionForm.
Steps to reproduce the behavior in User Interface (UI)
Set Hyrax.config.collection_model = '::Collection' in e.g. config/initializers/hyrax.rb
Boot Hyrax app
Hyrax::Forms::CollectionForm.model_class should evaluate to ::Collection, but is instead Hyrax::PcdmCollection
Actual behavior (include screenshots if available)
Upgrading from 4.x to 5.x and expecting old ::Collection behavior to persist results in lots of unexpected broken behavior around Collections.
Acceptance Criteria/Expected Behavior
Setting Hyrax.config.collection_model = '::Collection' persists to Hyrax::Forms::CollectionForm.model_class
An easy workaround would be to have an environment variable like HYRAX_COLLECTION_MODEL optionally used for the default before falling back to a hardcoded default. A clean fix would be to defer setting Hyrax::Forms::CollectionForm.model_class until after Rails configuration/initialization has taken place.
The text was updated successfully, but these errors were encountered:
Descriptive summary
In Hyrax v5, the default for
Hyrax.config.collection_model
changed from'::Collection'
to'Hyrax::PcdmCollection'
(https://github.com/samvera/hyrax/blob/main/lib/hyrax/configuration.rb#L898). This should be able to be overridden by settingHyrax.config.collection_model = '::Collection'
in a Hyrax initializer. Unfortunately,Hyrax::Forms::CollectionForm.model_class
seems to be initialized before configuration takes place (https://github.com/samvera/hyrax/blob/main/app/forms/hyrax/forms/collection_form.rb#L19), causing a default ofHyrax::PcdmCollection
to persist inHyrax::Forms::CollectionForm.model_class
when interacting with anyCollectionForm
.Steps to reproduce the behavior in User Interface (UI)
Hyrax.config.collection_model = '::Collection'
in e.g.config/initializers/hyrax.rb
Hyrax::Forms::CollectionForm.model_class
should evaluate to::Collection
, but is insteadHyrax::PcdmCollection
Actual behavior (include screenshots if available)
Upgrading from 4.x to 5.x and expecting old
::Collection
behavior to persist results in lots of unexpected broken behavior around Collections.Acceptance Criteria/Expected Behavior
Hyrax.config.collection_model = '::Collection'
persists toHyrax::Forms::CollectionForm.model_class
An easy workaround would be to have an environment variable like
HYRAX_COLLECTION_MODEL
optionally used for the default before falling back to a hardcoded default. A clean fix would be to defer settingHyrax::Forms::CollectionForm.model_class
until after Rails configuration/initialization has taken place.The text was updated successfully, but these errors were encountered: