rails/rails
Glossary
Vocabulary used throughout the Rails codebase. This is not the public Rails API; it's the words you'll bump into while reading the source.
Architectural terms
- Component / framework — one of the 12 gems in the monorepo (Active Record, Action Pack, etc.). The terms are used interchangeably.
- Railtie — a small subclass of
Rails::Railtiethat hooks a gem into the Rails boot process. Every framework defines one. Seerailties/lib/rails/railtie.rb. - Engine — a full mini-application that ships its own
app/,config/, andlib/.Rails::Engine < Rails::Railtie, andRails::Application < Rails::Engine. Seerailties/lib/rails/engine.rb. - Application — the user's app, an instance of
Rails::Application(theirconfig/application.rbdefinesMyApp::Application). - Initializer — a block of code declared via
initializer "name"on a Railtie/Engine; runs in dependency order during boot. The phases are documented inrailties/lib/rails/application.rb. - Lazy load hooks —
ActiveSupport.on_load(:active_record) { ... }lets a gem patch a class only after that class is defined, preserving load-time independence. Seeactivesupport/lib/active_support/lazy_load_hooks.rb. - Autoloader / Zeitwerk — Rails uses Zeitwerk for autoloading code. Wrappers live in
activesupport/lib/active_support/dependencies/autoload.rbandrailties/lib/rails/autoloaders.rb. - Concern —
ActiveSupport::Concern(activesupport/lib/active_support/concern.rb) is the standard mixin pattern for modules that need their own class methods and dependencies. - Notifications —
ActiveSupport::Notificationsis the pub/sub bus. Components publish events likesql.active_recordandprocess_action.action_controller; subscribers (log subscribers, instrumenters, tests) consume them.
HTTP and routing
- Rack — the Ruby web-server interface. Every Rails request begins as a Rack
envhash and ends as a[status, headers, body]triple. - Middleware — Rack middleware ordered in
actionpack/lib/action_dispatch/middleware/stack.rb. The default stack is built inrailties/lib/rails/application/default_middleware_stack.rb. - Router / route set —
ActionDispatch::Routing::RouteSet(actionpack/lib/action_dispatch/routing/route_set.rb) maps URLs to controller#action. - Journey — the routing engine itself, a port of an in-house pattern matcher. Lives in
actionpack/lib/action_dispatch/journey/. - Endpoint — what
RouteSet#dispatchcalls; usually a controller class but can be any Rack app. - Metal —
ActionController::Metal(actionpack/lib/action_controller/metal.rb) is the minimal controller base class that includes only what you opt into.ActionController::Baseand::APIbuild on it.
Active Record terms
- Connection adapter — a subclass of
ActiveRecord::ConnectionAdapters::AbstractAdapter. Translates Ruby calls into SQL for a specific database. The shipped ones aremysql2,trilogy,postgresql,sqlite3. - Connection pool / handler — manages connections per thread. See
activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb. - Schema cache — cached column definitions to avoid round-trips at boot. See
activerecord/lib/active_record/connection_adapters/schema_cache.rb. - Relation — an
ActiveRecord::Relation. A composable, lazy query builder. Seeactiverecord/lib/active_record/relation.rb. - Predicate builder — turns hashes like
{ name: "Bob" }into Arel WHERE nodes. Seeactiverecord/lib/active_record/relation/predicate_builder.rb. - Arel — the SQL AST library used internally by Active Record. Lives in
activerecord/lib/arel/. - Type —
ActiveRecord::TypeandActiveModel::Typedefine how columns map to Ruby objects (String,Integer,Time, JSON, etc.). - Association — has_many / belongs_to / has_one / has_many :through, etc. Implementation lives in
activerecord/lib/active_record/associations/. - Migration — Ruby DSL for schema changes (
activerecord/lib/active_record/migration.rb). - Multiple databases — Rails supports primary/replica routing via
ActiveRecord::Base.connects_toandApplicationRecord.connected_to. Handled inactiverecord/lib/active_record/database_configurations/andconnection_handling.rb.
Active Job terms
- Queue adapter — pluggable backend (Sidekiq, Resque, GoodJob, Solid Queue, etc.). Built-in adapters live in
activejob/lib/active_job/queue_adapters/. - Argument serialization —
ActiveJob::Argumentsserializes job arguments to a JSON-safe form so adapters can persist them. - Continuation / continuable — a recently-added pattern (
activejob/lib/active_job/continuation/) for resuming long-running jobs after restarts.
Active Storage terms
- Service — a storage backend. Built-in services in
activestorage/lib/active_storage/service/:DiskService,S3Service,GCSService,MirrorService. Azure was extracted to a separate gem. - Blob — the
ActiveStorage::Blobmodel represents one stored file plus its metadata. - Attachment — a join record (
ActiveStorage::Attachment) tying a Blob to a parent record. - Variant — a derivation of a Blob (resized image, transcoded video). See
activestorage/lib/active_storage/transformers/. - Previewer / Analyzer — extracts metadata or generates a preview image (
activestorage/lib/active_storage/previewer/,analyzer/).
Action Cable terms
- Channel — the unit of subscription on the server (
actioncable/lib/action_cable/channel/). Like a controller, but for WebSocket subscriptions. - Connection — one client's persistent socket; authentication and identification happens here (
actioncable/lib/action_cable/connection/). - Subscription adapter — pluggable broadcast backend (
async,redis,postgresql,solid_cable).
Action Mailer / Mailbox / Text
- Mailer — a class inheriting from
ActionMailer::Base. Each public instance method is a deliverable email. - Inbound email — a saved email message accepted by Action Mailbox.
- Routing — the DSL in
application_mailbox.rbmatches inbound emails to mailboxes. - Trix — the in-browser rich-text editor used by Action Text.
- Action Text content —
ActionText::Contentwraps the HTML fragment plus its embedded attachments (actiontext/lib/action_text/content.rb).
Active Support terms
- Core extensions — patches to standard library classes (
Object,String,Hash, etc.) underactivesupport/lib/active_support/core_ext/. Each file can be required individually. - Cache store — a subclass of
ActiveSupport::Cache::Store(memory, file, mem_cache, redis, null, plus Solid Cache as a separate gem). - Current attributes —
ActiveSupport::CurrentAttributesis per-request global state that's safe across threads. - Error reporter —
ActiveSupport::ErrorReporteris the canonical way to capture exceptions for monitoring backends. - Event reporter — newer subsystem in
activesupport/lib/active_support/event_reporter/for emitting structured events. - Executor / reloader —
ActiveSupport::ExecutorandActiveSupport::Reloaderwrap units of work so the framework can reload code in development.
Conventions and patterns
- Convention over configuration — Rails' design ethos. A controller called
PostsControllerautomatically renders templates fromapp/views/posts/, queries thepoststable, etc. load_defaults—Rails::Application::Configuration#load_defaults(version)opts an app into the recommended config for a given Rails version (railties/lib/rails/application/configuration.rb).config.action_*,config.active_*— every component reads its own config namespace from the application config.- Top-level deprecator — each component owns a
Deprecatorinstance so warnings can be silenced or escalated per gem (activerecord/lib/active_record/deprecator.rband friends). - Frozen string literals — every Ruby file in the repo starts with
# frozen_string_literal: true. - Minitest, not RSpec — Rails uses Minitest. Test files live in
test/, neverspec/. bin/test— the per-component test runner. Wrapstools/test.rb.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.