Ruby on Rails 5
Learn how to pragmatically build and design Rails 5 apps in this step-by-step, project-based course.
Build a complete Rails web app from scratch, step by step!
Learn how to put all the pieces together to build a complete Ruby on Rails 5 app from idea to deployment in this course. You'll come away with a solid understanding of Rails as well as key design principles and practices to help you craft robust and flexible apps on your own!
This course package includes both Rails 5 courses and the new Rails 6 course!
“This is the best Rails training hands-down! I've worked through several Rails courses and they don't even come close to explaining things as well as you do.” Thomas Neal
“This Rails course is fabulous! I took a few other courses, but still felt really confused. I learned a lot, feel more comfortable with Rails...This is my favorite Rails course.” Dana Nourie
“Our new hires are loving your online Ruby and Rails courses. In the past, our senior engineers taught new team members Rails on their own. But now with your courses, we are getting new engineers up to speed much easier and faster.” Eirik Holm, AppFolio
“I completed a few Rails tutorials before but this course contained more lightbulb moments than the rest of them put together. The explanations were clean, clear, and precise, and breaking things down into diagrams really helped. I know after completing your courses that I can build pretty much whatever I want in Rails.” Jonathan Mundy
Build a Full-Featured Rails 5 App From Scratch
Learn how to rapidly develop and deploy database-driven web apps the Rails way.
You can build amazing web applications with Rails, fast! But a huge part of developer productivity comes from understanding the Rails way of doing things. And the best way to learn Rails is by building real applications from scratch, preferrably with seasoned Rails developers at your side.
In this course, we incrementally build a Rails application step-by-step in the videos so you see exactly how it's done. Then, after each video, you apply what you learned by building another Rails application through a series of guided exercises. Learning this way makes everything "click", and it's just more fun! 😀
By developing real applications with real code, you'll gain practical experience putting all the pieces together to craft applications using Rails best practices. And you'll come away with a deeper understanding of both the how and the why.
Working in the context of an application, we explore the following topics in-depth:
1. Rails Programming Environment
Setting up your working environment and learning how to use it effectively is the first step toward becoming a productive Rails developer. We'll show you how to:
- Install Ruby on Rails on your favorite operating system
- Edit Rails code using the Sublime Text editor
- Use the Rails console and supporting command-line tools effectively
- Search Rails documentation
- Use external RubyGems in your application
- Troubleshoot problems and understand common error messages
The router is the central dispatch of your application. It receives incoming requests (URLs) and, depending on a set of rules, dispatches the requests to an appropriate controller action. You'll learn how to:
- Define routes that recognize incoming URLs
- Use named route methods to generate URLs based on the routing scheme
- Apply and understand the RESTful routing conventions
- Design apps to take advantage of the REST conventions in Rails
3. Views and Controllers
Rails has some strong opinions about how web apps should be designed. You've probably heard about the MVC design in the abstract, but we'll break it down in practice so you understand where to put your code and the benefits of a decoupled design. You'll learn how to:
- Write controller actions to handle incoming requests and render views, or redirect to other actions
- Design clean and flexible HTML 5 views using layouts, partials, and helpers
- Write custom view helpers to encapsulate presentation logic
- Remove duplication using before actions
4. Models and Database Design
Well-designed models are the foundation of any good Rails app. In the simplest form, a model is a Ruby class that encapsulates your application's business logic. But a model also often represents an entity stored in your database. Active Record is the object-relational mapping library that Rails uses to connect your business objects (models) to your database tables. You'll learn how to:
- Manage your database schema with migrations
- Use models to create, read (query), update, and delete records in your database
- Use validations to enforce data integrity
- Design models for better reuse and testability
5. Test-First Development Using RSpec and Capybara
Both the Ruby and Rails communities place a high value on testing, and it's for good reason. Writing effective tests allows you to make changes and add new features with confidence. As a result, you're a more productive Rails developer. Throughout the course, you'll learn how to:
- Use a test-first development approach to confidently add new features
- Write and run high-level feature specs using RSpec 2 and Capybara
- Test lower-level business logic by writing model specs using RSpec
- Refactor your application code, safely!
Want to accept user input and store it in a database? Rails has a whole bunch of conventions to help you create robust and friendly forms. We'll unveil the "magic" and show you how to:
- Design a form for creating and editing data
- Validate form data and provide actionable feedback to the user
- Store submitted form data in a database and dynamically display the data
- Avoid common security pitfalls
7. CSS and Sass Basics
As a web developer, it's important to understand the basics of web design whether you aim to do it all yourself or plan to work hand-in-hand with a web designer. You'll learn how to:
- Decouple your presentation (style) from the content using CSS stylesheets
- Keep your stylesheets tidy and flexible using Sass extensions including variables, nested rules, and functions
- Effectively use what Rails calls the asset pipeline
8. Model Relationships
One of the most powerful features of Rails is the ability to create relationships between different models and represent those relationships in a database. For example, if you're developing a movie review app then you'll need to associate each review with a particular movie. To do that properly, it's important to not only understand the Rails conventions but also what goes on behind the scenes. You'll learn how to:
- Design a one-to-many relationship in the database using foreign keys
- Declare associations in the models and use them to create associated records and navigate across the one-to-many relationship
- Use nested resources to design a user interface for a one-to-many relationship
- Encapsulate business logic that emerges once you have rich associations between models
9. Manage Users
Whether you choose to build your own user account management system or use a gem, it's critical to know how everything fits together. Managing your users' accounts isn't an area of your app that should be a black box. By learning how to design a solid user model and web interface from scratch, you'll be in a better position to adapt, customize, leverage, and troubleshoot either your own code or a third-party gem. We'll start off by looking at how to:
- Design a solid user model
- Securely store passwords with the bcrypt gem
- Declare reasonable validations in the User model
- Create new user accounts with a sign-up form
- Display users' profile pages
- Allow a user to edit or delete their account
10. Authentication & Session Management
You sign in and out of web apps every day. It's so routine that it's easy to take account management features for granted. But the reality is there's a lot going on behind the scenes. Implementing account management properly in an app requires a solid understanding of sessions, cookies, filters, security concerns, and Rails conventions for authentication and authorization. We'll break it all down and look in-depth at how to:
- Add routes for a singular session resource
- Design a SessionsController to manage the session resource
- Create a sign-in form using form helpers
- Sign in (authenticate) users and remember them with sessions
- Automatically sign in a user when they create an account
- Sign out users
11. Authorization & Admin Users
Exactly who gets to take certain actions and do certain things in your app? What can signed-in users do? What can't they do? What can admin users do? Authorization rules tend to vary widely depending on the nature of a specific application. The good news is once you understand the basic technique, you can easily design an authorization system that works for your custom needs. You'll learn how to:
- Use before_action filters to restrict access to specific actions
- Restrict access based on signed-in status
- Redirect a user back to his intended URL after he has signed in
- Hide unauthorized features
- Allow special "admin" users to perform admin-only tasks
12. Many-to-Many & Through Associations
Rails has powerful conventions to help you manage many-to-many associations, but the conventions alone only take you so far. It's up to you to model the associations with the full stack in mind: from the database tables all the way through to the user interface. By way of six distinct examples (three in the videos and three in the exercises), you'll learn how to:
- Design a rich many-to-many association that connects a user to their movie reviews using a join model and a form
- Model a many-to-many association that lets a user "fave" multiple movies with a button
- Create a through association for assigning multiple genres to a movie using checkboxes
- Improve the performance of database queries
- Name associations to better express your domain
13. Custom Routes
URLs are the user interface of the web. We tweet and email them. We bookmark pages we want to return to later. We use embedded links to connect across web apps. As part of your app's user interface, it's critical that your URLs are both expressive and friendly. The default resource URLs are a good start, but the Rails router gives us a lot of flexibility when it comes to customizing URLs. And well-designed URLs might also end up driving more search traffic to your site! You'll learn how to:
- Generate friendly URLs for better SEO, bookmarking, and curb appeal
- Customize routes to handle scenarios beyond the basic resource routes
- Use route parameters and constraints
Putting your Rails app into production shouldn't cause fear and trembling. Deploying Rails apps has gotten a lot easier over the years thanks in large part to cloud services such as Heroku. We'll show you how to deploy your Rails app for the first time, and incrementally push out updates. You'll learn how to:
- Set up a (free) Heroku account
- Put your application code in a Git repository
- Deploy your app to your Heroku account
- Run remote Heroku commands such as to migrate your production database
- Upload image files and store them on Amazon S3
- Roll out updates to your app with ease!
15. Best Practices, Tricks, and Techniques
Now standing up a Rails app that just works isn't the same as designing a good Rails app. Mastering Rails—writing compact, readable, and flexible code—starts by learning the conventions, practices, and idioms fostered by the Rails community.
And having developed with Rails for 15+ years, we've learned our own tips, tricks, and techniques for creating solid Rails apps. So, throughout the course, we discuss design principles and best practices to help you get the most out of Rails!
On average, students complete the first part of this course in roughly 27 hours and the second part in roughly 16 hours, which includes watching the videos and doing all the exercises in the workbooks. Download the 30-Day Plan for Part 1 and the 20-Day Plan for Part 2, we'll walk you through the course in short sessions day-by-day!
- 1. Introduction and Setup
- 2. Create the App
- 3. Views and Controllers
- 4. Models
- 5. Connecting MVC
- 6. Migrations
- 7. Helpers
- 8. Routes: Show Page
- 9. Routes: Linking Pages
- 10. Test-First (Optional)
- 11. Forms: Editing
- 12. Forms: Creating
- 13. Partials
- 14. Destroy
- 15. Custom Queries
- 16. Migrations Revisited
- 17. Layouts
- 18. Assets
- 19. Validations
- 20. The Flash
- 21. One-to-Many: Models
- 22. One-to-Many: Nested Resources
- 23. One-to-Many: Forms
- 24. One-to-Many: Logic
- 25. Deployment
- 26. Wrap Up
- 1. Introduction and Setup
- 2. User Accounts: Model
- 3. User Accounts: UI
- 4. Sign In
- 5. Sign Out
- 6. Authorization
- 7. Admin Users
- 8. Many-to-Many Associations
- 9. Through Associations
- 10. Many-to-Many with Checkboxes
- 11. Actions-Specific Layout Content
- 12. Scopes
- 13. Custom Routes
- 14. Friendly URLs
- 15. Wrap Up
Both Rails 5 Courses + New Rails 6 Course
Both Rails 5 Courses + Rails 6 Master Package
For New Rails Developers
Want to learn and become confident with Rails? We designed this course for you!
Getting started with Rails?
Perhaps you've been intrigued by Rails, but haven't yet had the opportunity to learn it comprehensively from scratch. It all starts here! You'll learn the fundamentals of developing web apps with Rails so you're ready to create your first Rails app or jump right into an existing app. No prior experience with Rails is assumed.
If you're new to the Ruby programming language or new to object-oriented programming in general, we strongly recommend taking our Ruby Programming course prior to this course.
Struggling to put all the pieces together?
Rails is a structured framework that relies on conventions to optimize development time and minimize the amount of code you have to write. This makes developing web apps a bit easier… once you understand how everything fits together. Through live coding, animated visuals, and hands-on exercises, you'll learn how to build a full-featured web app so you're more confident (and less frustrated) writing your own Rails code.
Ready for a refresh and a restart?
If you started learning Rails a while back but haven't used it in earnest, this course will help you quickly get back up to speed with the latest version of Rails and current development techniques!
We aim for 100% satisfied developers, so if this course turns out not to be a good fit for you, we'll gladly issue you a 100% refund.
Created by Mike and Nicole
Hi, we're real people just trying to share our passion for creating stuff!
Howdy! Mike here. I helped build and launch one of the first production Rails apps way back in 2005. I've built countless Rails apps since then, and I continue to develop the Rails apps that power our online business. I co-taught the first official Rails course in 2006 and have had the pleasure of teaching Rails to thousands of developers since then. I'm also the author of Advanced Rails Recipes, co-author of Agile Web Development with Rails, and author of Pragmatic Project Automation.
Together Nicole and I own and run The Pragmatic Studio. We'd love to have you join us in the Studio for this great course! Find out more about us…
Join thousands who have learned Rails using this top-rated course!
“It is the absolute best for a first dive into Rails! It teaches you the correct way to start a new Rails app...If you go through the whole course, [the] magic will be explained and you’ll know what the Rails framework does instead of passively look at it do things for you.” Nico Schuele
“I really love the quality of your videos and lectures, and the way it builds up an app. It's the best that I've taken!” Vita Dewi van Beurden
“This is the BEST Rails introduction anywhere on the web! I learned a ton in this course that I didn't learn from other sources online. I was immediately able to start putting together an application that has been stuck in my head for a long time.” Wassim Metallaoui
“Simply amazing. The best online course I have ever experienced. Nicole and Mike, you are the best!” Tony Barone
“This course along with your Ruby Programming course offers the best introduction to learning Rails for a beginning developer. I cannot think of any book or video series that does as good a job.” Eric Ricketts
“I highly recommend Pragmatic Studio's Rails Programming courses! The exercises allow you to build something more complex than a blog and do so by applying what was learned in the lessons rather than merely following along! This format really drove things home for me.” Bart Falzarano
“The main difference I have found after taking a lot of other Rails courses is that you explain things in greater detail which has helped me understand the 'whys'.” David Theroff
“It seems like there are a lot of courses and tutorials out there that are great if you already know how to program in another language, but there are none that I know of (other than Pragmatic Studio!) that is great for a complete beginner. After taking your Ruby course I feel like I have a solid foundation to stand on. Now, learning Rails has been a lot of fun instead of a lot of frustration.” Andrew Markle
“The Rails course is leagues above some others I've tried. First of all, Mike and Nicole have skills as instructors, not just developers, so I didn't feel they were talking above my head. Also it's clear that the lessons and supporting files have been tested and edited -- because they work! The exercises in the example apps are very relevant and I left the course with a whole new level of expertise. I can't recommend this course enough!” Anne Richardson
“I've taken other Rails tutorials but yours really filled in the gaps in my understandings. I can now truly say that I've taken a big step towards developing with Rails.” John Weir
“Everything is great: the material, the teachers, the simple, concise, yet clear explanations in all the courses. I think these are the best Ruby and Rails online courses for people that want to jump into Rails. All of the courses are worth every penny!” Alfian Losari
“This course is fantastic! I had read a couple of Rails tutorial books and sort of understood what the example code was doing, but was having trouble sorting out how to build my own app. This course really filled in some missing pieces.” Terrence Talbot
“After trying many online Ruby on Rails courses across the Internet, this is the most thorough and enjoyable introduction available. Rhys Yorke
“A partner and I just released and started getting sales on an RoR app I created. I was able to build the prototype in a weekend! You all are a big reason I was able to do it. You have done a wonderful job of taking a lot of the 'magic' out of Rails.” Justin Seiter
“Coming into the course, I had so many loose ends regarding how Rails worked, but I finished the course with the confidence to create my own app.” Brad Ballard