What is Rails?

Free preview 2 min to read

A full-stack framework

Every course so far taught Ruby the language: methods, blocks, classes, values. Rails is built on top of it. It's a full-stack web application framework, a large, opinionated set of tools and conventions for turning Ruby code into a working website. It handles everything from an incoming HTTP request to the HTML sent back.

"Full-stack" means Rails covers the whole path a request travels: routing (which code handles this URL), the database (through ActiveRecord), business logic, and the HTML sent back. It's one connected system, not separate tools glued together by hand.

Where Rails came from

Rails was extracted from a real application. David Heinemeier Hansson (DHH) built it in 2003 and 2004 while working on Basecamp, a project management tool at the company then called 37signals. Its earliest patterns were the ones that made Basecamp easier to build. They were pulled out and open-sourced in July 2004, and version 1.0 followed in December 2005.

This origin explains why Rails looks the way it does. Its conventions came from what worked while building a real product under real deadlines.

A framework means someone already made decisions

Without a framework, a web application starts with dozens of foundational questions before the first line of business logic. How are URLs mapped to code? How does the database talk to your objects? Where does view logic live? A framework is a large set of these decisions already made, consistently, by people who've built many applications.

Choosing Rails means accepting someone else's answers to most of those questions, so you don't answer them yourself on every project. The next lessons show why Rails makes that trade on purpose.

Key takeaways

  • Rails is a full-stack web framework on Ruby, covering routing, database access, business logic and HTML as one system.
  • Rails was extracted from Basecamp, built by DHH in 2003–2004, open-sourced in July 2004, with 1.0 in December 2005.
  • A framework is a large set of foundational decisions already made for you.
  • Choosing a framework means accepting those decisions instead of re-deciding them on every project.
Lesson 1 of 7 · free

Keep going with lesson 2

One convention, applied everywhere

How resources :articles creates seven actions as eight route entries, and how naming connects every layer.

A free account also gives you the quizzes, your progress and notes, and the discussion.

Type to start searching...