Class: Chats::Engine
- Inherits:
-
Rails::Engine
- Object
- Rails::Engine
- Chats::Engine
- Defined in:
- lib/chats/engine.rb
Overview
The mountable engine: wires autoloading, migrations, locales, the ActiveRecord macros, importmap pins, asset paths, and boot-time model configuration into the host app.
Constant Summary collapse
- LIB_ROOT =
Zeitwerk: the gem keeps its ActiveRecord models under lib/chats/models (same layout as the moderate gem) so the whole domain ships in lib/ and the engine’s app/ tree only holds the web layer (controllers, helpers, views). For that to autoload correctly we manage the loader by hand:
- `push_dir(lib/chats, namespace: Chats)` makes lib/chats/models/... autoloadable *under the Chats namespace*. - `collapse(models)` + `collapse(models/concerns)` mean the files in those folders define Chats::Conversation / Chats::Messager — not Chats::Models::Conversation. - The SPINE files (version/errors/configuration/macros/engine) are required explicitly by lib/chats.rb at boot, so they must be *ignored* by the loader or Zeitwerk would complain about double definitions / unmanaged constants.
File.("..", __dir__)
- CHATS_LIB =
File.("chats", LIB_ROOT)
- ZEITWERK_IGNORED =
%w[ version.rb errors.rb configuration.rb engine.rb macros.rb ].freeze