Installing Torque Admin is intentionally lightweight. The gem ships aDocumentation 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.
Railtie that hooks into Rails initialization automatically, so there are no generators to run and no configuration files to copy. All you need to do is declare the gem, mount the engine in your routes, and create a single base controller class. The steps below walk you through each of these in order.
Requirements
Before you begin, make sure your application meets the following minimum versions:| Dependency | Minimum version |
|---|---|
| Ruby | 3.2.0 |
| Rails | 8.1 |
Add the gem to your Gemfile
Open your application’s Because Torque Admin is currently in alpha, you may also want to pin to the exact version to avoid unexpected updates:
Gemfile and add the torque-admin gem:Gemfile
Gemfile
Run bundle install
Install the gem and its dependencies:After bundling,
Torque::Admin::Railtie is automatically loaded as part of Rails’ boot sequence. It registers Torque::Admin as an eager-load namespace and extends ActionDispatch::Routing::Mapper with the admin routing helper — no require statements needed in your application code.Mount the engine in config/routes.rb
Torque Admin provides a first-class The Internally, the helper calls
admin routing helper that both mounts the engine and opens a block for declaring your admin resource routes. Add it to config/routes.rb:config/routes.rb
admin helper accepts an optional path argument and keyword options that are forwarded to mount. By default the engine is mounted at /:name (i.e. /admin for the default instance). You can customise the path like this:config/routes.rb
mount once per application instance and then opens a Mapper scoped to the engine’s routes, so every call to resources or resource inside the block is registered against the correct admin engine rather than the host application.Multiple admin instances are supported. Call
admin :ops do … end for a second named application — it will be mounted at /ops and maintain its own isolated routes, controllers, and configuration.Create a base controller
Torque Admin does not generate a base controller for you. Create one that inherits from your application’s own Including
ApplicationController and includes Torque::Admin::BaseController:app/controllers/admin/base_controller.rb
Torque::Admin::BaseController wires in several key concerns automatically:Elements::Frame— manages Turbo frame context for streamed responsesElements::Templates— provides the template lookup pipeline used by ElementsElements::Controller— exposes theelementandmain_menuclass-level DSLSettingsController— exposes per-request admin configuration helpers
admin), so Rails will look for app/views/layouts/admin.html.erb in your host application first before falling back to the engine’s own layout.How the Engine Namespace Works
When theadmin routing helper first runs, it builds a Torque::Admin::Application instance and calls engine.isolate_namespace with a module named after the application — Admin::Engine for the default instance. This means:
- Route helpers are scoped under
admin_(e.g.admin_posts_path) - The engine is accessible as
Admin::Engine - Controller lookups happen relative to the
Adminnamespace
Admin::Post is treated as a separate model), set isolate_namespace: true in your admin configuration. The default (nil) uses a hybrid mode: routes and helpers are isolated, but models are resolved globally.
Next Steps
With the gem installed and the engine mounted, you’re ready to build your first resource controller and see the admin interface in the browser.Quickstart
Follow the step-by-step quickstart guide to create your first admin resource and visit the dashboard in under five minutes.
