Class: Sessions::Engine
- Inherits:
-
Rails::Engine
- Object
- Rails::Engine
- Sessions::Engine
- Defined in:
- lib/sessions/engine.rb
Overview
The mountable engine: wires autoloading, migrations, locales, the ‘has_sessions` macro, the request-capture middleware, and all three adapters into the host app — every adapter strictly capability-detected, so the gem is inert wherever its target isn’t present.
Constant Summary collapse
- LIB_ROOT =
Zeitwerk: the gem keeps its ActiveRecord models and jobs under lib/sessions/models,jobs (same layout as the moderate and chats gems) 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/sessions, namespace: Sessions)` makes lib/sessions/models/... autoloadable *under the Sessions namespace*. - `collapse(models)` + `collapse(models/concerns)` + `collapse(jobs)` mean those files define Sessions::Event / Sessions::Model / Sessions::GeolocateJob — not Sessions::Models::Event. - The SPINE files (version/errors/configuration/adapters/…) are required explicitly by lib/sessions.rb at boot, so they must be *ignored* by the loader or Zeitwerk would complain about double definitions / unmanaged constants.
File.("..", __dir__)
- SESSIONS_LIB =
File.("sessions", LIB_ROOT)
- ZEITWERK_IGNORED =
%w[ version.rb errors.rb configuration.rb current.rb ip_address.rb device.rb classifier.rb geolocation.rb middleware.rb macros.rb adapters engine.rb ].freeze