Skip to content

Ruby on Rails

Rails is a full-stack web framework built on Ruby: routing, an ORM, view rendering, background jobs, WebSockets, mailers and a test harness, all shipped together and all expected to work with each other. That integration is the point. A Rails application is less a set of libraries you assemble and more a shape you fill in.

Most Rails interview questions are not about Rails. They are about the consequences of the two decisions below — what happens when convention is wrong, when the ORM hides a query, when the callback you did not know about fires.

“Rails is MVC plus convention over configuration. The router maps a URL to a controller action; the controller loads models, applies business rules and assigns instance variables; the view renders those variables to HTML. Conventions — PostsController lives in app/controllers/posts_controller.rb, the table for Post is posts, the primary key is id — remove the configuration files other frameworks need. Active Record maps rows to objects but does not hide SQL, so the real skill is knowing which Ruby line becomes which query. The framework is opinionated, so the useful senior signal is knowing where the opinions stop working: business logic that does not fit a model, queries that N+1, callbacks that cascade.”

Convention What it saves you
File paths mirror class names No autoload registry; Zeitwerk resolves Admin::User to app/models/admin/user.rb
Table name is the pluralised, underscored class name No mapping file; LineItem → line_items
resources :posts gives seven RESTful routes No route table to design per resource
Foreign key is <association>_id belongs_to :author reads author_id
index action renders posts/index.html.erb No template declaration
_form.html.erb is the partial for form render "form" finds it

The flip side: when you deviate you pay in configuration, and a reader who does not know the convention cannot follow the code. self.table_name = "legacy_orders" is legitimate but it is a cost, not a style choice.

  • Action Pack — routing, controllers, views, helpers, filters.
  • Active Record — the ORM: models, migrations, associations, validations, callbacks.
  • Active Model — validations and dirty tracking for objects that are not database-backed.
  • Active Job — one interface over Sidekiq, GoodJob, Solid Queue and friends.
  • Action Cable — WebSockets integrated with the same models and channels.
  • Action Mailer / Active Storage / Action Text — email, uploads, rich text.
  • Turbo and Stimulus — the Hotwire default front end, no separate SPA required.
  • Rake tasks, generators, credentials, a test harness — the operational scaffolding.

Rails 8 ships Solid Queue, Solid Cache and Solid Cable as database-backed defaults, which means a small application needs no Redis at all. That is a meaningful change to the “you must run Redis” assumption in older interview answers.

If your Ruby itself is shaky, read the Ruby track first: blocks, modules and method_missing are what Rails DSLs are made of.

  1. What exactly does Zeitwerk do, and what breaks when a file is in the wrong directory?
  2. Which parts of Rails would you remove for a JSON API, and what do you keep?
  3. Where does Rails’ “magic” actually live — what mechanism implements it?
  4. Why is ApplicationRecord an abstract class rather than ActiveRecord::Base directly?
  5. What does config.eager_load change between development and production?
  • “Rails is a language.” Ruby is the language. Rails is a gem set built on Rack.
  • “Convention over configuration means no configuration.” It means defaults you can override, not an absence of decisions.
  • “Active Record means you never write SQL.” It means you rarely write it — and every inefficiency you ship is still SQL.
  • “Rails cannot scale.” Rails scaled GitHub, Shopify and Basecamp. What does not scale is a codebase with no boundaries, in any framework.
  • “Rails is Rails 3.” Answers from 2012 (asset pipeline, observers, attr_accessible) are wrong today and interviewers notice.