skip to content

Project Anatomy & Startup

How a Rails app is created, laid out and started: rails new options, directory and naming conventions, boot, Zeitwerk autoloading and upgrades. Interviewers use it to test real project experience.

part ofRuby on Railsread it →
on this pageshow

explore

questions

page 2 of 2

In Rails 8.1, how do config.active_support.deprecation, disallowed_deprecation_warnings and Rails.application.deprecators help keep the next upgrade cheap?

level: seniorimportance: should knowfreq 32%

basics

~10 s

config.active_support.deprecation picks how warnings are reported; disallowed_deprecation_warnings with disallowed_deprecation = :raise turns chosen warnings into errors; Rails.application.deprecators applies both to every framework deprecator and to ones you register.

open as a page

In Rails 8.1, what do ActionDispatch::Executor and ActionDispatch::Reloader do for each request, and when must you wrap code yourself?

level: seniorimportance: should knowfreq 30%

basics

~20 s

ActionDispatch::Executor wraps every request in the app's executor, whose callbacks enable the query cache, release database connections and reset Current attributes. ActionDispatch::Reloader, present only when reloading is on, reloads changed code first. Threads you start need Rails.application.executor.wrap.

open as a page

In a Rails 8.1 parcel-tracking app, how would you insert a request-timing middleware ahead of the session store, and what can break?

level: seniorimportance: should knowfreq 38%

basics

~20 s

Call config.middleware.insert_before ActionDispatch::Session::CookieStore, ParcelTimer in config/application.rb and confirm with bin/rails middleware. It breaks when the anchor class is absent in some environment (boot fails), when you edit the stack after boot, or when a reloadable class goes stale.

open as a page

How would you set a Rails upgrade cadence for a portfolio of a dozen Rails apps, given Rails' six-month releases and support windows?

level: principalimportance: should knowfreq 22%

basics

~20 s

Anchor the policy to Rails' windows: every app must stay on a security-supported minor and the latest patch, and most should follow each new minor within a set period. Deprecation ratchets, a next-Rails CI build and a shared playbook keep each step small.

open as a page

In Rails 8.1, what does `rails new --devcontainer` generate, and how does the containerised app reach its PostgreSQL database?

level: middleimportance: nice to knowfreq 18%

basics

~10 s

rails new --devcontainer writes .devcontainer/devcontainer.json, a Dockerfile and compose.yaml; with -d postgresql, compose adds a postgres service, devcontainer.json sets DB_HOST to it, and database.yml reads DB_HOST as the host.

open as a page

In a Rails 8.1 app, what do Rails.autoloaders.main.collapse and Rails.autoloaders.main.ignore change, and when would you use each?

level: seniorimportance: nice to knowfreq 22%

basics

~20 s

collapse keeps a directory managed but stops it from being a namespace, so app/models/filings/motion.rb defines Motion. ignore removes files or directories from Zeitwerk entirely, so they are neither autoloaded nor eager loaded and must be required by hand.

open as a page

showing 31–36 of 36