Learnr

Learn Ruby

Learn the expressive language built for programmer happiness, then Rails.

or browse all courses.

Free to start. Built from a single prompt. No credit card.

Ruby is a dynamic, object-oriented language created by Yukihiro Matsumoto with the stated goal of making programmers happy. Everything is an object, even numbers, so you can write 5.times { puts "hi" }. Blocks let you pass chunks of code to methods like each and map, which makes Ruby code read almost like prose. It is best known for Ruby on Rails, the web framework behind many startups, and it is also used for scripting and tooling. Learnr builds you a personalized Ruby course from one prompt and teaches it through short, interactive lessons, from irb experiments to a small Rails app.

How to learn Ruby, step by step

  1. Install Ruby and explore in irb. Install a current Ruby with a version manager like rbenv or asdf, then open irb, the interactive Ruby shell. Call methods on everything, like "hello".upcase and 10.class, to see that everything is an object.
  2. Learn hashes, symbols and arrays. Practice arrays and hashes with symbol keys such as { name: "Ada" }, plus ranges like 1..10. Understand that symbols are lightweight identifiers, which is why Rails uses them everywhere.
  3. Master blocks and iterators. Use each, map, select, reject and reduce with both brace and do...end block syntax. Blocks are what make Ruby feel like Ruby, and idiomatic code rarely uses a classic for loop.
  4. Write classes and modules. Define classes with initialize and attr_accessor, then share behavior with modules included as mixins. Include Comparable or Enumerable in your own class to see how much the standard library gives you.
  5. Use gems, Bundler and tests. Create a Gemfile, install gems with bundle install, and write tests with Minitest or RSpec. Build a small command-line tool, like a word frequency counter or expense tracker.
  6. Build a Rails app after the basics. Follow the official Rails Getting Started guide to build a blog with models, controllers, views and migrations. A Learnr streak on core Ruby keeps you from treating Rails conventions as magic.

What you'll learn

  • Write Ruby with strings, symbols, arrays, hashes and ranges
  • Use blocks with each, map, select and reduce fluently
  • Design classes and share behavior with modules and mixins
  • Manage dependencies with gems and Bundler
  • Build a simple web app with Ruby on Rails

What's inside your Ruby course

A sample path Learnr builds for Ruby. Your real course adapts to your goal and level.

  • 1. Ruby basics in irb
  • 2. Strings, symbols, arrays and hashes
  • 3. Methods, blocks and iterators
  • 4. Classes, modules and mixins
  • 5. Gems, Bundler, files and testing
  • 6. Your first Ruby on Rails app

How long does it take to learn Ruby?

Core Ruby takes about 4 to 8 weeks at 5 hours a week, since the syntax is friendly. Building a small Rails app with a database usually takes 3 to 5 months in total. Prior programming experience makes both phases faster.

What you need before you start

No programming background is needed for Ruby itself. For Rails, some HTML, CSS and basic SQL concepts help. You need a terminal and Ruby installed.

Common mistakes to avoid

  • Starting with Rails before learning plain Ruby. Rails relies on conventions that look like magic unless you understand blocks, classes and modules first.
  • Writing index-based for loops out of habit. Use each, map and the other Enumerable methods, which are clearer and idiomatic.
  • Confusing nil handling and getting NoMethodError on nil. Check for nil explicitly or use the safe navigation operator &. where a value may be missing.

How Learnr builds your course

Type your topic

Tell Learnr you want to learn Ruby, or get as specific as you like.

Get a personalized course

Learnr instantly builds a full Ruby course tailored to your goal and skill level.

Learn and level up

Move through bite-sized lessons and interactive practice, earning XP and keeping your streak.

Ruby questions, answered

Is Ruby still worth learning?

Yes. Ruby on Rails remains in use at many established companies and startups, and Ruby is still used for scripting and developer tooling. It is a pleasant language to learn programming concepts with.

What is the difference between Ruby and Ruby on Rails?

Ruby is the programming language. Rails is a web framework written in Ruby that provides structure for database-backed web apps, including models, views, controllers and migrations.

Is Ruby good for beginners?

Yes. Its readable syntax and helpful interactive shell let you focus on programming ideas rather than punctuation, and the community has a strong tradition of beginner-friendly material.

Explore more courses

More programming and tech courses

See all programming and tech courses

Ready to learn Ruby?

Start your free, personalized Ruby course in seconds. .