What is Ruby on Rails & Why Is It Useful?

Ruby on Rails (sometimes RoR) is the most popular open-source web application framework.

It’s built with the Ruby programming language.

You can use Rails to help you build applications, from simple to complex, there are no limits to what you can accomplish with Rails!

What is a framework?

A framework is a collection of code, tools & utilities that give you a specific structure to work with when you’re writing software.

This structure makes your code more organized.

Your work becomes easy when you learn to use it correctly.

What Does Rails Do Exactly?

Rails helps you build websites.

The kind of websites that you use every day.

Sites that allow you to log in, leave comments & reviews, make purchases…

Rails is made from several components to facilitate this.

For example:

Active Record helps you read, create & update records in your database without having to be a database genius.

While the routing mechanism allows you to easily map URLs (like /login) to specific actions.

If you had to code all of this from scratch, without a framework, it would be a MASSIVE amount of work.

But Rails handles all of these details for you

So you can focus on building your own applications!

Examples of Ruby on Rails Applications

Who is using Rails?

What are some examples of Ruby on Rails sites?

Here are some:

  • Github
  • Shopify
  • Ask.fm
  • Kickstarter
  • Scribd
  • ConvertKit
  • Twitch
  • Instacart
  • Zendesk
  • SoundCloud

These are not small companies!

And all of them benefit from using Ruby on Rails to serve their customers.

Should You Learn Rails?

If you’re looking for a challenging, fun & creative career building amazing websites that help people, then Ruby on Rails may be for you.

Anyone can learn Rails, even if you don’t have programming experience.

It may take more or less time depending on where you are.

But every skill CAN be learned & mastered.

The benefits of using Rails:

  • It’s an integrated solution. Rails gives you everything you need to create a web application.
  • Rails conventions & default configuration saves you a lot of work!
  • Rails has a great ecosystem so you can find all the tools & support that you may need
  • It’s under active development, so you get fixes & new features on a regular basis!

And the best reason of all:

“You get to use Ruby which remains the most extraordinarily beautiful and luxurious language I’ve yet to encounter” – DHH, creator of Ruby on Rails

The Rails Philosophy

Ruby on Rails is an opinionated framework.

One of these opinions is that convention should be more important than configuration.

What does that mean?

It means you have to make less decisions because the creators of Rails already made them for you.

Because you have to make less decisions you’ll be more productive & gets things done faster.

But if you want to change some of these, you can.

What are some examples of convention over configuration?

Rails looks for specific file names when looking for your code.

For example, if you have a Book model, Rails will look for a file named app/models/book.rb.

This is the convention.

Instead of having to say:

“Hey Rails, this is where to find this file”

Rails tells you where it should be.

A Ten Thousand Foot Overview Of Rails

How does Rails fit in the big picture of a complete web application?

I drew something for you:

Ruby on Rails Overview

Rails receives requests, routes them to the appropriate action, which then interacts with the database (via ActiveRecord) to fulfill the request. Then it returns the results (HTML or JSON) back to the user.

If you want to zoom in on Rails part we have to get a bit technical.

Rails uses the MVC architecture.

MVC stands for Model, View, Controller.

Here’s the picture:

Ruby on Rails MVC

Actions are organized into controllers, the controllers make decisions on how to process the request & they ask the database for any data that it needs.

Then the controller renders the view.

A view is the design & content of the page.

It’s the final product that will be returned to the user.

Who Invented Ruby on Rails?

David Heinemeier Hansson (DHH) released Ruby on Rails 1.0 on December 2005.

Almost 14 years later, David is still working on Rails with a big group of open-source contributors to make it better & faster.

Why did he create Rails?

“I created Rails because I want to enjoy what I work with” – DHH

Seems like a pretty good reason to me 🙂

Ruby vs Ruby on Rails

Ruby is a programming language.

Ruby on Rails is a framework built on top of Ruby.

What’s the difference?

Ruby is what converts the source code (including Rails) into something your computer can understand.

Rails is a layer on top of Ruby.

A layer that helps you build web applications.

But Ruby by itself can do much more than that, it’s a powerful programming language.

Here are some things you can do:

  • You can crawl & scrap websites to extract information
  • You can automate tasks like backups, alerts & notifications
  • You can build all kinds of tools & utilities, like log parsers, security scanners, file content analysis…

The takeaway is this:

Rails makes Ruby a really good platform for building web applications, but there is also a strong ecosystem of non-Rails programs built using Ruby.

How to Get Started Learning Rails

Now:

Here’s the biggest mistake that a lot of people make.

But you can avoid it if you understand this:

Learn general programming concepts & the Ruby programming language first.

Before jumping into Rails!

The reason is simple.

You CAN’T start building a house by the roof…

If you don’t understand the foundations of how Rails works, you’re going to get confused.

When you see an error message it’s going to sound like a foreign language.

And that’s going to be VERY frustrating for you.

The solution?

Start by learning Ruby.

Have patience, make sure you learn things well.

If you’re looking for a free beginner-friendly Ruby tutorial, here is one I wrote for you.

It covers all the basics.

And it does something unique that most tutorials don’t:

  • It motivates you to keep going.
  • It keeps things simple.
  • It warns you of possible pitfalls & things to pay special attention to.

Ready to start your Ruby developer journey?

Start learning Ruby now.

4 thoughts on “What is Ruby on Rails & Why Is It Useful?”

  1. I definitely agree with “Learn general programming concepts & the Ruby programming language first.” I actually tried learning rails first a few years ago and was so confused (and didn’t understand what was happening in my code!).

    • Yes! I see a lot of beginners online struggling with basic error messages & other problems that wouldn’t be an issue if they understood how Ruby works.

    • A good Ruby tutorial should cover these. To be more specific, I mean things like variables, loops, arrays, understanding error messages & OOP (Object-Oriented Programming).

      Then for web development you also want to learn about the HTTP protocol (how websites communicate with web browsers), cookies & sessions, front-end vs back-end, etc.

Comments are closed.