Module: Parse::PluralizedAliases
- Defined in:
- lib/parse/model/core/pluralized_aliases.rb
Overview
Global const_missing hook that lazily resolves the plural form of a
Object subclass constant to that class. Referencing Posts
when a class Post exists installs Posts as an alias for Post on
the referencing module and returns it, so query entry points like
Posts.where(...).count work without any per-model boilerplate.
The hook is prepended onto Module so it applies to constant lookups
in any namespace (top-level and nested). It is tightly guarded: every
path that is not a plural-of-a-Parse-class falls through to super,
preserving normal NameError and autoloader (Zeitwerk/classic)
behavior. The whole feature is gated on pluralized_aliases? so
opting out (Parse.pluralized_aliases = false) makes this a near-zero
cost pass-through.