Ruby on Rails

The framework that popularized convention over configuration.

What is it?

Ruby on Rails (usually just "Rails") is a web framework for the Ruby language, released in 2004 by David Heinemeier Hansson. Its core idea is convention over configuration: if you follow Rails' naming and folder conventions, an enormous amount of wiring — database mapping, routing, form handling — just works without you writing config for it. It popularized the modern idea of scaffolding a working app in minutes, an approach later frameworks like Laravel and Django borrowed from directly.


When to use it

Rails is a strong choice when you want to move from idea to working product fast — it's still used by companies like Shopify, GitHub (originally), and Basecamp precisely because it gets a full-featured web app running with very little boilerplate. The trade-off today is ecosystem size: Ruby's job market and hiring pool have shrunk relative to Node.js and Python, and beginner tutorials are less abundant than they were a decade ago. If job prospects or community size are your top priority, Node or Python are safer bets.


Core concepts
  • MVC — Rails structures apps into Models (database/data logic), Views (templates), and Controllers (request handling), a pattern many later frameworks copied.
  • Active Record — Rails' ORM maps database tables to Ruby classes automatically, so User.find(1) just works once a users table exists.
  • Convention over configuration — name a file and class the way Rails expects, and routing, database columns, and views connect themselves with no explicit config.
  • Migrations — database schema changes are written as versioned Ruby files you can apply and roll back, instead of hand-written SQL.
  • Scaffolding — a single CLI command can generate a full working create/read/update/delete interface for a resource, useful for prototyping fast.

A taste of the code
# app/models/post.rb
class Post < ApplicationRecord
  validates :title, presence: true
end

# app/controllers/posts_controller.rb
class PostsController < ApplicationController
  def index
    @posts = Post.all
  end
end

No SQL, no manual serialization — Post.all already knows how to talk to the database because of the table name and class name matching Rails' conventions.


Your first steps
  1. Learn basic Ruby syntax first — blocks, symbols, and Ruby's object model are different enough from JS/Python to warrant a short detour before Rails itself.
  2. Install Ruby and Rails, then scaffold a project with rails new my_app.
  3. Run rails server, open localhost:3000, and generate a resource with rails generate scaffold Post title:string body:text to see the full stack generated for you.
  4. Run rails db:migrate to apply the generated migration, then visit /posts to see a working CRUD interface.
  5. Work through the official "Getting Started with Rails" guide — it builds a small blog end to end.

← Back to Stack Picker All primers