A Beginner's Guide to Ruby on Rails

Ruby Rails

By Danny Kirschner

Ruby on Rails, commonly known as Rails, is a server-side framework that helps developers build modern web applications. It is written in the Ruby programming language and makes programming web applications easier by making certain assumptions about what every developer needs in order to get their application up and running.

Rails is open-source software, meaning anyone can view, edit, and contribute to the source code. It’s released under the MIT License, a legal structure with few restrictions for software reuse, which contributes to Rails’ widespread presence. At the time of writing, Rails has more than 3,300 contributors on GitHub. Everything a developer needs to create database-backed web applications according to the commonly used Model-View-Controller (MVC) pattern is included within the framework.

Rails is opinionated software designed for developer happiness and to help small and large companies launch fast, affordable, production-ready applications. You’ll sometimes hear the phrases “convention over configuration” and “the Rails way,” which refers to adhering to the conventions and the “best” way to do things as agreed upon by the creators of the Rails framework. By adhering to Rails conventions, you’ll likely discover a tremendous increase in productivity; if you attempt to go against conventions, you may have a slower and less ideal experience.

The History of Rails and Its Rise in Popularity

Rails began as an internal framework used at a company called Basecamp, within its eponymous project management platform. In July 2004, David Heinemeier Hansson, Ruby on Rails creator and Basecamp founder, extracted Rails from Basecamp and made it available to the public. The framework gained popularity in 2005 when Hansson, known as DHH in the Rails community, showed off Ruby on Rails’ awesome capabilities and speed by live-coding a completely functioning, database-backed blogging engine in under 15 minutes. Apple further legitimized the Rails framework when it shipped Ruby on Rails with its Mac OS X v10.5 Leopard operating system in October 2007.

Rails gives developers a quick way to get started building a web application with opinionated scaffolding, which generates the model, view, and controller for a new database-backed resource in a single command-line operation. Rails also includes much of the boilerplate code that connects the various pieces of modern database-backed web applications, such as Active Record (the ORM, responsible for mapping database records to application objects), and the Rails router (links incoming requests to actions in the controller). This contrasts with earlier languages used to write applications for the web, like Java, Python, and PHP.

Without a framework like Rails, a developer has to write a lot of code to achieve what Rails could do in just a few lines. Rails also includes live reloading, which means your changes are immediately reflected as you edit your application files.

For anyone who needs a web application, from new developers to seasoned pros, and companies of all sizes, Rails is a great way to jump into developing web applications. Rails’ lasting impact can be seen in other web frameworks it has influenced; it brought automated QA testing for web applications front and center, included JavaScript as a large piece of the framework, endorsed REST principles early on, and reinforced the productivity gains of “convention over configuration.” Rails’ large and friendly community, made up of thousands of developers writing countless plugins (called Gems), continues to drive the framework’s success. Each year, they flock to RailsConf, a highly anticipated event where developers hear about new ideas and innovations within the Ruby on Rails framework and community.

Rails at General Assembly

In General Assembly’s Web Development Immersive and Web Development Immersive Remote, we introduce Rails as a modern web application framework. Developers utilize Rails to act as the back-end server for their full-stack applications — like in this site created by Web Development Immersive graduate Nikki Riser, which allows users to study Japanese words. This means students learn to use Rails as the application programming interface, or API, with the ability to handle incoming requests, model and validate data, communicate with the database, and send data back in a response. They then write front-end application code in JavaScript to consume their back-end API. JavaScript uses a technique called AJAX to communicate with a back end like a Rails API, resulting in a seamless single-page application (SPA).

By learning how to build web applications using Ruby on Rails, new developers gain experience creating and consuming APIs. This introduces a number of important concepts in full-stack web development, including:

  • Receiving requests to a server.
  • Creating routes for incoming requests.
  • Connecting to a database like PostgreSQL.
  • Validating data at the model layer.
  • Sending JSON responses.
  • Adhering to the MVC pattern.
  • Writing tests for application code.

Meet Our Expert

Danny Kirschner is a lead instructor for General Assembly's Web Development Immersive course in Providence, where he teaches students how to be job-ready full-stack developers. Danny has been writing web apps using Ruby on Rails and JavaScript for more than eight years. When not coding, he enjoys cooking vegetarian food and biking around Rhode Island.

“Technology moves fast. You need to be good at knowing what and how to learn, and always be learning. Knowledge about a topic can quickly become stale, so knowing how to use the next great thing is required to stay relevant.”

Danny Kirschner, Web Development Immersive Instructor, General Assembly Providence