Ruby on Rails

Definition

Ruby on Rails (often shortened to Rails) is an open-source full-stack web application framework written in Ruby architecture and promotes the principles of “convention over configuration” (CoC) and “don’t repeat yourself” (DRY).

Overview

Created by David Heinemeier Hansson (DHH) in 2004, Rails was first used to power Basecamp (formerly 37signals). It popularized the concept of developer productivity in web development and inspired frameworks in many other languages.

Key Features

  • Convention over configuration: Sensible defaults reduce boilerplate code
  • Scaffolding: Auto-generate CRUD operations, database migrations, and views
  • Active Record: ORM that maps database tables to Ruby classes
  • RESTful routing: URL conventions for resources and actions
  • Asset pipeline: Compilation of CSS, JavaScript, and CoffeeScript
  • Mailers: Built-in email sending with templates
  • Testing: Integrated testing framework (Minitest/RSpec)

Architecture

  • MVC pattern: Models (data), Views (presentation), Controllers (logic)
  • Active Record: Database abstraction layer
  • Action Controller: Request/response handling
  • Action View: Template rendering (ERB, Haml, Slim)
  • Action Mailer: Email delivery
  • Action Cable: WebSocket support for real-time features

Major Versions

Version Year Key Features
Rails 1 2004 Initial release, MVC, Active Record
Rails 2 2007 Routing, named scopes, partials
Rails 3 2010 Middleware stack, multiple DB adapters, gems as dependencies
Rails 4 2012 Async queue, Turbolinks, Action Cable preview
Rails 5 2016 Active Job, Action Cable, API mode, WebSockets
Rails 6 2019 Booleans in migrations, generators, Action Text, Action Mailbox
Rails 7 2021 Import maps, Hotwire/Turbo, Action Text, parallelized test runs
Rails 8 2024 Webpacker removal, async uploads, importmaps-rails, stimulus-rails

Ecosystem

  • Gems: Over 150,000 Ruby gems available via rubygems.org
  • Hotwire: Turbo + Stimulus for modern SPA-like experiences without JavaScript frameworks
  • Devise: Authentication gem
  • Sidekiq: Background job processing
  • PgBouncer: Database connection pooling

Licensing

Ruby on Rails is released under the MIT License, an OSI-approved permissive open-source license. It is free to use, modify, and distribute for any purpose, including commercial use.

See rails/rails for details.

Use Cases

  • Rapid prototyping and MVP development
  • SaaS applications (Basecamp, GitHub initially, Shopify initially)
  • Content management systems
  • API backends (Rails API mode)
  • E-commerce platforms