Ruby on Rails Overview
Introduction
- Ruby on Rails: A server-side web application framework written in Ruby under the MIT License.
- Released: Initially in July 2004 by David Heinemeier Hansson from his work on Basecamp.
- Latest Stable Release: Version 8.0.2 released on 12 March 2025.
- Repository: GitHub
- Website: rubyonrails.org
Key Features
- Model-View-Controller (MVC): Provides default structures for databases, web services, and web pages.
- Convention over Configuration (CoC) and Don't Repeat Yourself (DRY) principles.
- Active Record Pattern: An object-relational mapping system for database access.
- Innovative Features: Seamless database table creation, migrations, and scaffolding for rapid application development.
Framework Influence
- Influenced many web frameworks including Django (Python), Laravel (PHP), and Phoenix (Elixir).
- Used by major sites like Airbnb, GitHub, and Shopify.
Technical Overview
Model-View-Controller Pattern
- Model: Maps to a database table and a Ruby file; follows "convention-over-configuration".
- Controllers: Handle web server requests, query models, and render views.
- Views: Usually erb files converted to HTML at runtime; supports various templating systems.
HTTP Servers
- Commonly paired with web servers like Phusion Passenger, Apache, and Nginx.
JavaScript
- Extensive use of JavaScript libraries; as of Rails 7.0, includes the Hotwire family by default.
Web Services
- Supports HTML and XML as standard output formats for RESTful web services.
CSS
- Sass introduced as standard CSS templating in Rails 3.1.
Ruby Versions
- Rails 3.0 designed to work with Ruby 1.8.7, 1.9.2, and JRuby 1.5.2+.
Framework Structure
- ActiveRecord: Object-relational mapping system.
- Action Pack: Handles controller and view functionality.
- Active Support and Action Mailer: Additional functionalities.
Deployment
- Typically deployed with MySQL or PostgreSQL databases and a web server like Apache.
Philosophy and Design
- Convention Over Configuration (CoC): Simplifies development by adhering to conventions.
- Don't Repeat Yourself (DRY): Ensures information is stored in a single place.
- Fat Models, Skinny Controllers: Most application logic resides within models.
Version History Highlights
- Rails 3.1: Introduced Asset Pipeline and CoffeeScript.
- Rails 4.0: Introduced Russian Doll Caching and Turbolinks.
- Rails 5.0: Introduced Action Cable and API mode.
- Rails 6.0: Made Webpack default; introduced Action Mailbox.
- Rails 7.0: Replaced Node.js with import maps for JavaScript management.
- Rails 8.0: Empowered developers for independent hosting.
Reception
Scalability
- Criticisms over scalability issues, notably by Twitter's transition to Scala for certain services.
- Despite criticisms, used by many high-profile web firms for scalable applications.
Security
- Highlighted vulnerabilities like mass assignment and session cookie persistence issues.
- Security improvements and recommendations in subsequent Rails updates.
Trademarks
- Trademark applications for "RUBY ON RAILS" and "RAILS".
- Trademark for the Rails logo was canceled on 25 October 2019.
Conclusion
Ruby on Rails remains a highly influential framework in web development, valued for its emphasis on conventions, rapid development capabilities, and robust community support.