Every Torque Admin portal is represented by anDocumentation 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.
Application object. It binds together a dynamically generated Rails Engine subclass, an ActiveSupport::InheritableOptions config struct, and a Ruby module that acts as the isolated namespace for all of the admin’s controllers, resources, and helpers. Most applications only need a single instance — the :default one — but the design supports any number of independent admin portals inside the same Rails process.
Accessing an Application
TheTorque::Admin[] factory method is the canonical entry point. Calling it with the same name always returns the same object; calling it with a new name provisions a fresh, fully isolated instance.
[] method is defined as:
Torque::Admin.instances, a simple hash keyed by symbol.
Application Attributes
AnApplication exposes five public readers once initialized:
| Attribute | Type | Description |
|---|---|---|
name | Symbol | Canonical name (:default becomes :admin) |
config | ActiveSupport::InheritableOptions | Deep-duplicated copy of DEFAULT_CONFIG |
engine | Class < Torque::Admin::Engine | Dynamically generated Rails Engine subclass |
mod | Module | Ruby namespace module (e.g. Admin, Partner) |
auth_resources | Hash | Map of resource name → authentication provider |
Configuring the Application
Pass a block toconfigure and mutate the config object directly. All options accept the values documented in the config source, and the block is yielded synchronously — there is no deferred evaluation.
Displayed name of the admin portal. A plain string is rendered as text; a
Proc is called and its return value is rendered as HTML; a Symbol invokes the named helper method. Defaults to the application name titleized.Root URL path at which the engine is mounted (e.g.
"admin"). When nil, the value is inferred from the path: or at: option passed to the admin route helper at mount time.Name of the CSS framework adapter to use. Supported values are
"bootstrap", "bulma", "semantic_ui", and "tailwind". The chosen adapter is loaded lazily when ui_builder is first accessed.When
true, heavy actions such as index are rendered via ActionController::Live streaming, flushing each section of the page as it becomes ready. Set to false to disable streaming globally.Controls how the admin module is isolated.
nil (default) applies a hybrid approach — isolated helpers and routes but not relative model naming. true is a fully isolated Rails namespace. false skips isolation entirely.String name of the host application controller that becomes the superclass of the admin’s generated
BaseController. Provide a string to avoid eagerly loading the constant.Application Lifecycle
finalize_routes! is appended to the engine’s route set during the admin helper call, so it runs automatically at boot after all resource routes have been declared.
Namespace Module and Lazy Constants
setup_application_module creates (or reuses) a module at Object::Admin (for the default app), then extends it with Application::LazyModules. That module intercepts const_missing to build the following constants on first access:
| Constant | Built as |
|---|---|
Admin::Resource | Class.new(Torque::Admin::Resource) |
Admin::BaseController | Inherits from config.base_controller, includes BaseController concern |
Admin::ResourceController | Inherits from BaseController, includes ResourceController |
Admin::DashboardController | Inherits from BaseController, includes DashboardController |
Admin::SimpleController | Inherits from ResourceController, includes SimpleController |
The clear Method
clear is the reset hook. It empties the resource registry, drops the cached ui_builder and base_controller, unmounts the engine flag, and removes all lazy constants from the namespace module.
clear is registered as a before_class_unload callback so the admin resets cleanly before Rails reloads the application code:
