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 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.
Installation
Rails can be installed as a Ruby gem. However, the following must be installed beforehand:
- Ruby version 2.7.0 or later (preferably the latest version).
- SQLite3 is the default database for Rails.
- Node.js (version 8.16.0 or later) for running JavaScript (JS) on a local machine.
- Yarn (either version 1 or 2) for installing and managing JS 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
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:
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.