Question:

What is Ruby on Rails?

Ruby on Rails is a web framework that makes it fast to build web applications. It’s written in Ruby and gives you everything you need to build a full web app out of the box. Code Q&A is built with Rails.

Rails was created by David Heinemeier Hansson (DHH) in 2004 while he was building Basecamp. He extracted the framework from that project and released it as open source. It spread quickly because it made building web apps dramatically faster than what developers were used to at the time. GitHub, Shopify, Airbnb, and many other major companies built their products on Rails.

Rails is batteries included. A new Rails app comes with a database layer, routing, HTML templating, and a testing setup ready to go. Rails picks the libraries for you so you don’t have to make those decisions yourself.

The other big idea is convention over configuration. Instead of requiring you to write boilerplate code to wire things together, Rails makes sensible decisions based on naming conventions. If you follow the conventions, things just work.

Rails uses the MVC pattern, which stands for Model, View, Controller. Models handle your data and database logic. Views are the HTML templates users see. Controllers sit in the middle and handle requests from users, fetch data from models, and pass it to views. It’s a clean separation that keeps your code organized.

One of Rails’ best features is Active Record, its built-in ORM. Instead of writing SQL, you write Ruby code to query your database. User.where(active: true) is a lot nicer than writing a SQL query by hand.

I remember when Rails first came out and started generating buzz. Big apps like GitHub were being built with it and people became huge fans. I used it for side projects and hackathons for years. In 2017 I joined a tiny startup that used Rails, which was the first time I used it professionally. The startup after that also ran on Rails. And when I started building Code Q&A, Rails was the obvious choice. Rails is still very much relevant today.

You might also like