Learn Ruby on Rails

Ruby on Rails is an open source web development framework designed to get cleanly coded applications up and running with the minimum of time and the maximum of programmer happiness (and we’re not kidding, programmer happiness is one of Ruby’s official goals!). If you’re looking for a path into creating highly functional web apps with all the bells and whistles in the shortest possible time and with the least possible pain, learning Ruby on Rails is a very good choice.

Our Ruby on Rails tutorials start with a set of fundamentals, then move on to intermediate topics that will help you take basic Ruby skills to a more advanced level. The course aims to make learning Ruby on Rails swift, but the more advanced course materials will make sure that you understand everything a Rails pro needs. You can start a high-quality Ruby on Rails curriculum, starting right now.

Those who already have some experience with Ruby on Rails and want to expand and deepen their skill set can either start on the intermediate tutorials straight away or pick a specific topic, like the extremely popular Test-Driven Rails trail, and dive in.

Trails

Ruby on Rails

Advanced ActiveRecord Querying

The ActiveRecord query interface is an impressive feat of engineering, but often we only use a small portion of it. In this trail we'll dive deep into ActiveRecord and learn how to build complex queries taking advantage of eager loading, sub-selects, ordering across joins, and more!

?

The ActiveRecord query interface is an impressive feat of engineering, but often we only use a small portion of it. In this trail we'll dive deep into ActiveRecord and learn how to build complex queries taking advantage of eager loading, sub-selects, ordering across joins, and more!

5 hours 6 minutes
Next Up

Introduction

In this course, we're going to go on a deep dive into ActiveRecord and teach you everything you need to know to manage complex relationships and queries. Joe Ferris, thoughtbot CTO and querying master, will be guiding us on our journey to help us take full advantage of ActiveRecord.

Unstarted

Querying belongs_to Associations

Learn everything you need to work with your belongs_to relationships inside the database. Use joins, merge, and more to define concise, efficient queries that take full advantage of ActiveRecord's power.

Unstarted

Querying belongs_to Associations Exercise

Put your new querying knowledge to the test with this exercise on querying belongs_to associations. Combine joins, merge, and the rest of tactics learned in the Querying belongs_to Associations video to lock in your new knowledge.

Unstarted

Querying has_many Associations

Learn advanced techniques for querying your `has_many` associations, including a deep dive into the `joins` method and how to use `merge` to compose queries and keep them logically separated.

Unstarted

Querying has_many Associations Exercise

Practice makes perfect, so dive into this exercise on querying has_many associations to lock in what you learned in the previous video. Use joins, distinct selects, and subqueries to query your has_many associations with ease.

Unstarted

Querying with Custom Joins

In some cases ActiveRecord just can't figure out the query you need, so you'll need to write it yourself. Luckily, it's not an all or nothing proposition. In this video learn how to use custom joins to answer complex questions about your database that ActiveRecord can't do for you.

Unstarted

Querying with Custom Joins Exercise

ActiveRecord can do a lot, but not everything. With this exercise, practice giving ActiveRecord a hand by writing custom SQL statements to define a join, all within the context of a larger ActiveRecord query.

Unstarted

Querying with Aggregations

After watching this video you'll attain querying master status. With this last installment, Joe teaches how to do some counts, minimums, maximums, averages, and sums. We'll even see how to perform these aggregations after grouping rows according to certain criteria and how to filter based on the results of these calculations, all via the database.

Unstarted

Querying with Aggregations Exercise

With this final exercise we'll bring everything together and even perform calculations and aggregations in the database. Complete this and you'll truly be a querying master.

9 steps remaining
Visit trail
Ruby on Rails

Intermediate Ruby on Rails (Rails 5)

Dig deeper into Ruby on Rails. This series of video tutorials will help you move beyond the basics and start understanding and using more advanced Ruby- and creating better Ruby apps.

?

Dig deeper into Ruby on Rails. This series of video tutorials will help you move beyond the basics and start understanding and using more advanced Ruby- and creating better Ruby apps.

3 hours 31 minutes
Next Up

1: Setup & Authentication

Unstarted

2: CRUD, Validations, and Partials

Unstarted

3: Polymorphic Associations

Unstarted

4: File Uploads with Paperclip

Unstarted

5: Rails Helpers

Unstarted

6: Complex Associations

Unstarted

7: Refactoring

Unstarted

8: Advanced Refactoring

Unstarted

9: Basic Search

Unstarted

10: Advanced Search

10 steps remaining
Visit trail
Ruby on Rails Testing

Test-Driven Rails

Learn Test-Driven Rails Development using RSpec and Capybara in this series of tutorials. As part of the course, you can follow along with Josh as he lets his test drive through each of the steps needed to build out an application.

?

Learn Test-Driven Rails Development using RSpec and Capybara in this series of tutorials. As part of the course, you can follow along with Josh as he lets his test drive through each of the steps needed to build out an application.

2 hours 18 minutes
Next Up

Introduction

The Ruby and Rails communities have begun to embrace test-driven design, and for many employers, it's a skill expected of developers. At thoughtbot, we consider it a core competency and drive all development through tests. For developers new to testing, however, the most common question asked is, "Why test?" Josh discusses the goals of testing, forms of testing, and the tools we commonly use when testing Rails applications.

Unstarted

Setting Up the App and Initial Test

Time to write our first test! In this video, Josh discusses how to lay the foundation of a test suite within a Rails application, outlines the structure of an acceptance test, and writes an initial test ensuring we can interact with the application itself.

Unstarted

Creating the First Todo

With an understanding of basic browser interactions, we're now equipped to dig deeper into the Todo application. We'll discuss new test assertions and how to interact with forms by creating a todo.

Unstarted

Signing In and Todo Ownership

A list of todos is arguably valuable only when the list is owned by one person (or a group of people), but not everyone in the world. In this video, Josh introduces a simple User model and ensures that the todos created are assigned to the person who's "signed in."

Unstarted

Refactor to User Model

We've gone over "Red, Green, Refactor", but haven't performed a larger refactor in the todo codebase. In this video, Josh refactors the controllers to isolate interaction of `session` and introduces a `User` class which mimics a basic authentication library.

Unstarted

Completing a Todo

Managing a list of tasks to accomplish is great, but you know what's even cooler? Being able to mark things as done. In this video, Josh drives tracking completion of todos through acceptance and unit tests, and covers the intricacies of RESTful actions within the todo application.

Unstarted

Refactoring Todo Completions

Tests are code too, and as such, they can be refactored during the "Refactor" step of "Red, Green, Refactor." In this video, Josh covers how to extract common interactions and assertions in the test suite (having introduced similar paths through todo creation, todo ownership, and todo completion).

Unstarted

Marking Todos Incomplete

What happens when you incorrectly mark a todo complete? You mark it incomplete, of course! In this video, Josh introduces functionality to mark completed todos as incomplete, and refactors the controller to leverage a similar interface to marking a todo as complete.

8 steps remaining
Visit trail

The Weekly Iteration

Hosted by

Joshua Clayton and Chris Toomey

Joshua Clayton
Chris Toomey

Rails makes many of our day to day tasks much easier, but sometimes this ease comes at a cost. Consistently across applications we see a lack of encapsulation and the shared global state of controllers and views to be one of the biggest sources of...

Hosted by

Chris Toomey

Chris Toomey

When all you have is the hammer of Rails, everything looks like a database backed dynamic site. But often we'd be much better served by a simple static site, and Middleman is a great choice for building these static sites. Join Chris as he shows...

Hosted by

Joel Quenneville and Derek Prior

Joel Quenneville
Derek Prior

Our languages give us great tools in the form of primitives: things like integers, strings, and arrays. However, over-relying on these leads to problems. This practice even has it's own fancy code smell name: Primitive Obsession. In this video,...

Hosted by

Joe Ferris

Joe Ferris

Ben joins Joe and build out the first feature in a Rails application, from scratch. Learn our process for jump-starting new applications using Suspenders. We'll also use our first integration test to help sketch out the first interactions in the...

Hosted by

Joe Ferris

Joe Ferris

Ben and Joe continue to develop the Pastie application, demonstrating how to introduce authentication. We discuss how to retrofit existing components with unit tests, as well as the differences between authentication and authorization.

Hosted by

Derek Prior and Chris Toomey

Derek Prior
Chris Toomey

Join Chris and Derek Prior (Development Director in thoughtbot's Boston office) to talk about Clearance, a great solution for email and password authentication. Just like Rails, Clearance is opinionated, and those opinions help make it more secure...

Hosted by

Derek Prior and Chris Toomey

Derek Prior
Chris Toomey

Rails 5 is on the horizon and now's the perfect time to take a look at the features and changes coming with this major release. Derek Prior takes us on a tour of the changes, as well as showing us how to upgrade to the current Rails 5 beta.

Hosted by

Ben Orenstein

Ben Orenstein

Ben offers a few concrete tips on landing a new (or better) Rails job.

Hosted by

Chris Toomey

Chris Toomey

Take a peek behind the scenes at some of features and workflows we've built up to help support Upcase as a production application and manage it across the varied environments of development, staging, and production.

Hosted by

Tute Costa and Chris Toomey

Tute Costa
Chris Toomey

Join Tute Costa, the maintainer of thoughtbot's Paperclip gem, as he talks about how to be the best maintainer you can be, including how to quickly respond to issues and how to version your code.

Hosted by

Derek Prior and Joel Quenneville

Derek Prior
Joel Quenneville

The Rails console is a Rails developer’s best friend. On this week’s episode we take a look at some little-known tips and tricks for increasing your efficiency in the console.

Hosted by

Chris Toomey and Melanie Gilman

Chris Toomey
Melanie Gilman

On this week's episode, Chris is again joined by Melanie Gilman to discuss the amazing array of extensions added to Ruby by Rails' Active Support component.

Hosted by

Joe Ferris and Chris Toomey

Joe Ferris
Chris Toomey

Slow and redundant database queries got you down? Well have no fear! On this week's episode, Chris and Joe dive deep into the strategies you can use to optimize your queries and get your app back to ludicrous speed ASAP.

Hosted by

Chris Toomey and Joel Quenneville

Chris Toomey
Joel Quenneville

Rack is the glue that binds application frameworks like Rails and Sinatra to web servers like thin and puma. In this episode Joël Quenneville takes us on a tour of Rack and shows us how we can take advantage of the Rack pattern to build more...

Hosted by

Derek Prior and Chris Toomey

Derek Prior
Chris Toomey

On this episode of the Weekly Iteration, Chris is again joined by Derek Prior, this time discussing building and extracting gems.

Hosted by

Joel Quenneville and Ben Orenstein

Joel Quenneville
Ben Orenstein

Joël Quenneville presents the why, what, and how of testing in isolation!

Hosted by

Chris Toomey and Joshua Clayton

Chris Toomey
Joshua Clayton

On this week's episode, Chris is again joined by Josh Clayton, Boston Development Director and TDD master, this time to discuss the power of page objects for cleaning up feature specs.

Hosted by

Gabe Berke-Williams

Gabe Berke-Williams

Gabe joins Ben to discuss Apprentice.io. They discuss how to be a great mentor, how to help apprentices feel comfortable, and how (and why) to run an apprenticeship program at your company.

Hosted by

Joel Quenneville and Derek Prior

Joel Quenneville
Derek Prior

We've been writing Ruby for years on lots of different projects and in many different environments. This has led to thoughtbot's Ruby style to be somewhat different to the rest of the community's. In particular, we tend to focus on a sub-set of...

Hosted by

Joshua Clayton and Chris Toomey

Joshua Clayton
Chris Toomey

On this week's episode, Chris is joined by Boston Development Director and TDD master Josh Clayton to discuss some of the tips we have here at thoughtbot for working with Heroku-deployed applications.

Hosted by

Joel Quenneville and German Velasco

Joel Quenneville
German Velasco

Mutation-related bugs are some of the most common in the Ruby world. Joël and German explore many of the gotchas related to mutation, how to avoid them, and discuss when mutation might not be necessary at all.

Hosted by

Chris Toomey and Ben Orenstein

Chris Toomey
Ben Orenstein

Recently, we ran a group-coding app-building contest for Upcase subscribers. In this video, Ben and Chris review each of the submissions, both highlighting great aspects and suggesting some areas for improvement. Live code review at its finest!

Hosted by

Chris Toomey and Ian C. Anderson

Chris Toomey
Ian C. Anderson

Keyword arguments allow us to write code that is both more expressive, and more flexible. Tune in as Ian and Chris dive into some of the more subtle aspects and demonstrate how we can use keyword args to produce clear, reliable code.

Hosted by

Chris Toomey and Derek Prior

Chris Toomey
Derek Prior

On this week's episode, Chris is again joined by fellow bot Derek Prior, this time to discuss Turbolinks. Tune in to learn how to speed up your Rails apps, almost automatically!

Hosted by

Ben Orenstein and Joe Ferris

Ben Orenstein
Joe Ferris

In this episode, Ben and Joe discuss Sandi Metz's rules. You can read the summarized rules. Pull 1 Pull 2 Pull 3 Reek

Hosted by

Chris Toomey and Melanie Gilman

Chris Toomey
Melanie Gilman

On this week's episode, Chris is joined by fellow thoughtbotter, Melanie Gilman, to discuss the wonder of Ruby's Enumerable and Comparable interfaces and how you can incorporate them into your own classes.

Hosted by

Chris Toomey

Chris Toomey

On this week's episode, Chris takes us through everything we need to work with PDFs in our Rails apps: the easiest way to generate them, how to properly serve them as responses in our controllers, and even how to test them.

Hosted by

Joshua Clayton

Joshua Clayton

This week, Chris is joined by thoughtbot's Development Director in Boston, Josh Clayton, to talk about factory_bot; a topic near and dear to Josh's heart, as he's been the maintainer of the project for over five years. FactoryBot is one of...

Hosted by

Joe Ferris and Gabe Berke-Williams

Joe Ferris
Gabe Berke-Williams

Joe and Gabe review form objects, and explain why they can almost always replace accepts_nested_attributes_for. See an example Rails app written with nested attributes and how and why we recommend switching to form objects. Nested Attributes...

Hosted by

Chris Toomey and Derek Prior

Chris Toomey
Derek Prior

Database views are a great way to separate the complexities of database persistence from your application logic. Unfortunately Rails doesn't have built-in support for them, making them difficult to work with. Scenic, a new gem from thoughtbot,...

Hosted by

Joel Quenneville and Chris Toomey

Joel Quenneville
Chris Toomey

If your application uses third-party APIs, it can be complicated to write good, flexible tests that don't depend on the service being present (or don't touch production data). In this Weekly Iteration, Joël Quenneville and Chris Toomey examine...

Hosted by

Chris Toomey and Derek Prior

Chris Toomey
Derek Prior

On this week's episode, Chris is joined by Derek Prior to discuss Rspec's Bisect, a tool to track down order-dependence in your test suite and banish pesky intermittent test failures.