Torque Admin is designed from the ground up to support multiple, fully isolated admin interfaces running side-by-side inside a single Rails application. This is useful when different audiences — internal staff, partner companies, third-party operators — each need a separate admin UI with different authentication rules, themes, and resource access. Every admin application gets its own Rails Engine, namespace module, configuration, router, and UI builder, with no shared state between them.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/crashtech/torque-admin/llms.txt
Use this file to discover all available pages before exploring further.
Creating a Named Application
TheTorque::Admin[] operator is the entry point. It accepts a symbol name and returns a memoised Application instance, creating it on first call:
Torque::Admin.configure is a convenience alias that targets the default (:admin) application:
Application instance owns:
| Component | Accessor | Notes |
|---|---|---|
| Configuration | app.config | Deep-duplicated from DEFAULT_CONFIG |
| Engine class | app.engine | Anonymous Class.new(Admin::Engine) |
| Namespace module | app.mod | Created under parent_module |
| Resource registry | @resources | Isolated hash; cleared on reload |
| Auth resources | app.auth_resources | Tracks which resources have auth configured |
| UI builder | app.ui_builder | Framework-scoped; cleared on reload |
Namespace Modules
When anApplication is initialised, it creates (or reuses) a module under parent_module (default: Object) whose name is the camelised application name. All engine-level constants — Engine, BaseController, Resource, and the lazy controller modules — are defined inside that namespace:
parent_module (the default 'Object'), their camelised names must be different. If you need two applications whose names would clash, assign a different parent_module: to one of them:
Each application’s
name (a symbol such as :admin or :partner, stringified) is used as the Rails layout name via layout admin_application.name.to_s in BaseController. For the :admin application the layout must be app/views/layouts/admin.html.erb; for :partner it must be app/views/layouts/partner.html.erb. Ensure these layout files exist and match the application name exactly.Independent Configuration Per Application
Every application starts from a deep-duplicated copy ofDEFAULT_CONFIG, so changing one application’s config never affects another:
isolate_namespace: option in particular can differ between applications:
nil(default) — hybrid: isolated helpers and routes, but not relative model naming.true— fullRails::Engineisolation (isolate_namespaceis called).false— no namespace isolation at all.
Mounting in routes.rb
Theadmin routing helper (mixed into ActionDispatch::Routing::Mapper by the gem’s Railtie) accepts an optional application name and path:
admin(:partner, '/partner-portal') the first time mounts Partner::Engine at /partner-portal, clears and rebuilds its route set, and marks the engine as mounted so subsequent admin(:partner) calls within the same draw only add routes without re-mounting.
The mount_options method on the Application stores the resolved path in config.root_path and passes as: :partner to the mount call, giving you named URL helpers like partner.accounts_path.
Separate Base Controllers
Each application’sbase_controller config controls which application controller the generated TAController inherits from. Create per-application base controllers to enforce separate authentication and layout logic:
Full Example
config/initializers/torque_admin.rb
config/routes.rb
Generated URL helpers
Development Reloading
EachApplication registers an ActiveSupport::Reloader.before_class_unload hook that calls app.clear. This resets @resources, @auth_resources, @ui_builder, and @base_controller, and removes all lazy constants from the namespace module. It also sets engine.mounted = false so the engine is remounted correctly on the next request. Both applications are reloaded independently, so a change in partner-facing code does not unnecessarily invalidate the internal admin’s state.