Module: Hyrax::RedirectToDisplayUrl
- Extended by:
- ActiveSupport::Concern
- Included in:
- CollectionsControllerBehavior, WorksControllerBehavior
- Defined in:
- app/controllers/concerns/hyrax/redirect_to_display_url.rb
Overview
Controller concern that sends visitors who land on a path with a redirect-table row pointing elsewhere to that other path. Included on work and collection show controllers via the curation-concerns behavior modules.
Two request shapes hit this concern:
- Direct UUID URL visits (
/concern/generic_works/<uuid>) — Rails routes natively to the show action. If the resource has a display alias, the row keyed on the UUID URL hasto_pathpointing at the alias, and the before_action 301s the visitor there. - In-process dispatches from
Hyrax::RedirectsController— the resolver finds a display-URL row and re-dispatches the request throughrecognize_path+controller.dispatch. To avoid the before_action firing again on the same logical request, the resolver setsrequest.env['hyrax.redirects.dispatched'] = truebefore dispatching; this concern checks the same env key and no-ops when set.
See documentation/redirects.md.