What Is Ruby on Rails?

Written by Tim Bornholdt

Published on June 9, 2021

If you’re just getting started with app development, you may see Ruby on Rails mentioned alongside coding languages like CSS, HTML, or Javascript.

But Ruby on Rails isn’t just a programming language.

So what is it? How does it work? And why is it favored among developers?

Let’s break it down.

What is Ruby?

To understand Ruby on Rails, you first need to meet Ruby.

Ruby is a programming language created by Yukihiro Matsumoto. Matsumoto wanted to create a language that was beautiful, elegant and simple, so he designed Ruby to be productive and fun and to follow the principles of good user interface design.

Compared to other programming languages, writing an app in the Ruby language feels more like you are writing prose in English.

So what is Ruby on Rails?

While Ruby was created in the 1990s, it remained relatively obscure until 2005 when David Heinemeier Hansson (or DHH as he’s referred to in the industry) used it as the programming language for his new server-side web application framework, Rails. Spun out of his work on Basecamp, DHH created Rails to automate repeated code and similar tasks and actions you do over and over again.

Let’s take the programming concept of “models.” (Stick with me, this might get a little conceptual.)

Take, for example, a car. Any standard car contains several individual elements which work in concert together, such as a steering wheel, brakes, and tires.

In order to get the car to perform an action, you generally perform a series of repeatable steps. Let’s say you want to drive your car around a corner. The steps might look like this:

  1. Activate your turn signal
  2. Apply the brakes to decelerate
  3. Rotate your wheel two and a half times clockwise
  4. Slightly accelerate as you go around the corner
  5. Return your steering wheel to its normal position

That series of repeatable steps is what we, as programmers, call a “function.”

A model can have a limitless number of functions, complete with various levels of complexity. In our car example, we could write functions for “yield for a pedestrian”, “back the car into the garage”, and “check the mirrors”.

When you create a model in a program, you first describe the components of the model (like the components of a car), and then you are free to describe what that model can do (like the “turn the car around a corner” example).

Taking this metaphor a little further, most models in a program that need to interact with a database have a standard set of actions you might want to apply to it. For example, you probably want to Create a record, Read a record that was created, Update the contents of that record, and Destroy it when you’re done with it. We lovingly call these common actions CRUD.

Ruby on Rails gives developers a way to very quickly describe the model they want to have, then it automatically creates those common actions, which greatly speeds up development. In a basic app, Rails generates about 75% of what would otherwise need to be written by hand, and the rest can be easily customized from there.

Let’s try another metaphor that is more applicable to something you might actually use Ruby on Rails for (because you wouldn’t download a car, right?). Perhaps you want to build a blog.

A blog consists of Posts (Post being our model). A Post needs to have a title, description, author, and body.

We need to be able to do some basic things with a Post. At a minimum, you want the ability to create a new Post, view an existing Post, update a Post, and remove a Post from your site.

Using Ruby on Rails’ scaffolding process, you can get all of that basic infrastructure created in about 30 seconds. Once that’s in place, you are free to worry about the other parts of a Blog that you’d want to worry about (like adding authentication mechanisms so only you can write or delete a post).

What makes Ruby on Rails superior to other backend development tools?

If you follow conventions, the power of Rails is that it does most of the easy work for you.

If you want to add a portfolio section to your Blog, you can scaffold your way there by just describing it. From there, Rails creates the database, adds the tables, defines the columns, and creates the basic pages that allow you to interface with your app.

Ruby on Rails also provides a lot of security mechanisms by default. Active Record, for example, gives you baked-in protections from common web attacks like SQL injections, and its use of authenticity tokens prevents CSRF attacks. This means that when you do things “the Rails way”, you can focus on other problems.

Developers also like using Rails because of the testing support that’s baked in. Rails is a test-driven development (TDD) language. While oftentimes developers start developing an app by writing code then writing tests to test the functionality of that code, TDD philosophy is that tests are written based on how the app should work, then code is written to pass the tests.

Testing and the fact that you can be very DRY with your code, along with all the scaffolding and baked in security, make Rails a huge proponent of backend developers.

The Rails developer community is incredibly strong, and many of the web apps you use today are powered by Ruby on Rails. AirBnB, SoundCloud, Hulu, Shopify, and Fiverr are just a sampling of the countless services that are powered by Ruby on Rails.

If your team needs help with a Ruby on Rails project, or if you want to have a deeper Rails discussion with a developer, let’s chat.

Be in the know.

Oh no, there was an error with your email!

Hey, thank you so much for signing up! We've got your address saved, so look forward to an email from us soon. 🎉

We respect your privacy.