automatic_namespaces icon indicating copy to clipboard operation
automatic_namespaces copied to clipboard

Application-specific inflections are loaded *after* automatic_namespace is initialized

Open gap777 opened this issue 2 years ago • 0 comments

The automatic_namespace assumed for a pack is pack_name.camelize. If the pack name contains words whose inflections are customized by an inflection config initializer in the app, the gem concludes a DIFFERENT namespace than Zeitwerk will conclude.

For example, if config/initializer/inflections.rb contains this:

inflect.acronym 'API'

and the pack is packs/api with automatic_namespace enabled, the gem will assign namespace Api to the classes, whereas Zeitwerk will expect the namespace API.

The work-around is to use the namespace_override: in the metadata list.

gap777 avatar Jun 06 '23 01:06 gap777