Ruby on Rails is an open-source web application framework.
A framework is a collection of code, tools & utilities that give you a specific structure to work with.
This structure makes your code more organized.
Ok, but 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.
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!
Who is using Rails?
What are some examples of Ruby on Rails sites?
Here are some:
These are not small companies!
And all of them benefit from using Ruby on Rails to serve their customers.
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:
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
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
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.
How does Rails fit in the big picture of a complete web application?
I drew something for you:
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:
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.
David Heinemeier Hansson (DHH) released Ruby on Rails 1.0 in 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 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:
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.
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.
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:
Ready to start your Ruby developer journey?