Module: Hyrax::RedirectsNormalization

Extended by:
ActiveSupport::Concern
Included in:
PcdmCollection, Work
Defined in:
app/models/concerns/hyrax/redirects_normalization.rb

Overview

Normalizes redirect path entries on assignment so every write path — form submissions, console writes, importers, change-set saves — produces canonical data. Read-side consumers can trust the persisted shape and skip their own normalization.

Included next to Hyrax::Schema(:redirects) on Hyrax::Work and Hyrax::PcdmCollection. The override sits on Valkyrie's set_value primitive so it fires under both flex modes (the simple schema's generated setter and the m3 singleton-class setter both route through set_value).

See documentation/redirects.md.

Instance Method Summary collapse

Instance Method Details

#set_value(key, value) ⇒ Object



19
20
21
22
# File 'app/models/concerns/hyrax/redirects_normalization.rb', line 19

def set_value(key, value)
  value = normalize_redirects(value) if key.to_sym == :redirects
  super
end