Module: LcpRuby::RecordAliases::Setup
- Defined in:
- lib/lcp_ruby/record_aliases/setup.rb
Overview
Boot-time validation for record aliases and slug fields.
Metadata-level checks (association shape, scope arity, slug format quality, STI child compatibility) are delegated to MetadataChecker so both this module and ConfigurationValidator emit identical wording.
Setup layers on the runtime-only checks that need loaded AR classes or a live database: scope existence on the built model class, and a scan for existing slug values that would be URL-unreachable.
Constant Summary collapse
- MAX_SLUG_FALLBACK_SCAN =
Bound for the fallback scan on adapters without server-side regex (e.g., SQLite). Tables larger than this are best checked out of band.
10_000- UNREACHABLE_SLUG_REGEX =
LcpRuby::ModelFactory::Builder::SLUG_INVALID_FORMAT
Class Method Summary collapse
Class Method Details
.apply!(loader) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/lcp_ruby/record_aliases/setup.rb', line 19 def self.apply!(loader) result = MetadataChecker.check_all(loader) raise MetadataError, result.errors.first unless result.errors.empty? result.warnings.each { |msg| warn_log(msg) } warn_existing_slug_data!(loader) validate_scope_existence!(loader) validate_current_user_aliases!(loader) end |