Ruby on Rails (Ruby)

Ruby on Rails is a full-stack web framework written in Ruby. It follows convention over configuration and the MVC pattern to let developers build database-backed web apps quickly.

Ruby

Rails is the framework that made Ruby famous for web development. It provides everything to build a web app: ActiveRecord (an ORM mapping classes to database tables), routing, controllers, views, migrations, mailers, and more, wired together with sensible defaults.

Its guiding philosophies are 'convention over configuration' (follow naming conventions and Rails wires things up automatically) and DRY (don't repeat yourself). Generators and the scaffold command can stand up CRUD features in minutes, and ActiveRecord leans heavily on Ruby metaprogramming for its expressive query and attribute APIs.

Rails popularized patterns now common across web frameworks. You manage its many gem dependencies with Bundler, and its readable, convention-driven code is a showcase of what Ruby's flexibility enables.

Examples

Ruby — ActiveRecord maps the Article class to an articles table.

# app/models/article.rb
class Article < ApplicationRecord
  validates :title, presence: true
end

# in a controller
@articles = Article.where(published: true).order(:title)

Learn it in a lesson

See also

Back to the Dictionary