Ruby on Rails

Ruby on Rails, or “Rails”, is an open-source server-side framework written in Ruby and used for building web applications. Rails provides a pre-built, boilerplate code that can be reused or customized in an application.

While particularly popular with startups, some well-known companies that use Rails include Airbnb, Basecamp, Github, Shopify, and SoundCloud.


Rails can be installed as a Ruby gem. However, the following prerequisites must be installed beforehand:

  • Ruby version 2.7.0 or later, but preferably the latest version.
  • SQLite3 is the default database used on Rails.
  • Node.js (version 8.16.0 or later) for running JavaScript alongside Rails.
  • Yarn (version 1 or 2 are both fine) for installing and managing JavaScript packages.

Help with installing these prerequisites can be found in “Getting Started with Rails”.

Lastly, Rails can be installed with the following command:

gem install rails

The MVC Pattern

Rails uses a common structural pattern known as the Model-View-Controller (MVC) pattern. It categorizes a web application’s code into three interconnected parts:

  • The Model that defines the data structure of the application.
  • The Views that use templates to represent the visual parts, like the Model data, of the application.
  • The Controller that works between the Model and Views to perform business logic for the application.

Use Cases

Ruby on Rails is used across many industries for building web apps and services. This includes applications like marketing websites, Content Management Systems (CMSs), eCommerce sites, and custom web applications. Tasks for working with Rails may include:

  • Creating templates that generate web pages for the front end.
  • Writing web services that return JSON for JavaScript-based front-end applications.
  • Writing server-side code in Rails and client-side code with HTML/CSS and JavaScript.


Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn More on Codecademy