Ruby on Rails is a full-stack web framework created by David Heinemeier Hansson and maintained by the Rails core team alongside a long-running open-source community. It's the #20 most-used web framework, reported in roughly 5.9% of developer surveys. Rails popularized the "convention over configuration" philosophy โ sensible defaults, an ActiveRecord ORM, and code-generating scaffolding โ and its productivity-first design directly influenced nearly every batteries-included framework that came after it, including Laravel and Django.
A Rails model built on ActiveRecord maps directly to a database table, and a controller action can query it with almost no extra code.
# app/models/post.rb
class Post < ApplicationRecord
validates :title, presence: true
belongs_to :author
has_many :comments
end
# app/controllers/posts_controller.rb
class PostsController < ApplicationController
def show
@post = Post.find(params[:id])
render json: @post
end
end
Install the Rails gem, then use its generator to scaffold a brand-new application with a working database connection.
# install Rails and create a new app
gem install rails
rails new my_app
cd my_app
rails server