O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Ruby on Rails Tutorial: Learn Web Development With Rails, Fourth Edition

Video Description

19+ Hours of Video Instruction

The Ruby on Rails Tutorial LiveLessons, Fourth Edition, is the best-selling complete video training course on web development with Rails, the popular web framework for building dynamic, database-backed web applications. You will learn Rails by example by building a substantial sample application from scratch.

Description

Best-selling author and leading Rails developer Michael Hartl teaches Rails by guiding you through the development of three sample applications of increasing sophistication, focusing on the fundamental techniques in web development needed for virtually any kind of application. The updates to this edition include full compatibility with Rails 5 and numerous new exercises interspersed in each lesson for maximum reinforcement. This indispensable guide provides integrated tutorials not only for Rails, but also for the essential Ruby, HTML, CSS, and SQL skills you need when developing web applications. Hartl explains how each new technique solves a real-world problem, and then he demonstrates it with bite-sized code that’s simple enough to understand, yet useful.

About the Instructor

MICHAEL HARTL is a best-selling author and founder of the educational website LearnEnough.com. His prior experience includes writing and developing RailsSpace, an extremely obsolete Rails tutorial book, and developing Insoshi, a once-popular and now-obsolete social networking platform in Ruby on Rails. In 2011, Michael received a Ruby Hero Award for his contributions to the Ruby community. He is a graduate of Harvard College, has a Ph.D. in Physics from Caltech, and is an alumnus of the Y Combinator entrepreneur program.

Skill Level

  • Beginner to intermediate

What You Will Learn

  • How to install and set up your Rails development environment
  • Optional easy start using pre-installed IDE in the cloud
  • How to build Rails applications from scratch
  • Learn testing and test-driven development
  • Effectively use the Model-View-Controller (MVC) pattern
  • Structure applications using REST architecture
  • Build static pages and transform them into dynamic ones
  • Implement registration and authentication systems, including validation and secure passwords
  • How to deploy your application

Who Should Take This Course

  • Developers looking for a practical introduction for building dynamic, database-backed web applications with Rails.

Course Requirements

  • Basic understanding of programming and development


Table of Contents

Lesson 1: From Zero to Deploy
The first lesson teaches you how to set up an integrated development in the cloud, create a first Rails application, and deploy it to production with Git and Heroku.

Lesson 2: A Toy App
In this lesson, you get up and running quickly with a toy application that demonstrates the basic workings of a Rails application with users and short posts. It includes a focus on interacting with the toy app through its URIs (sometimes called URLs) using a web browser. You learn how to generate dynamic web pages using the MVC pattern and structure web applications using the REST architecture.

Lesson 3: Mostly Static Pages
This lesson focuses on developing an industrial-strength sample application that is used throughout the rest of the video. You begin by creating static pages and then move on to adding a little dynamic content. After writing all the code from scratch, you develop the sample app using testing and test-driven development (TDD).

Lesson 4: Rails-Flavored Ruby
In a quick detour from building the sample application, you learn about the Ruby language underlying Rails. The lesson also shares how to include an application stylesheet in the sample application, call methods on strings, manipulate arrays and hashes, and define custom Ruby classes.

Lesson 5: Filling in the Layout
This lesson incorporate Twitter’s Bootstrap framework into the sample application, adds custom styles, and fills in the layout with links to the pages created so far. Topics covered include partials, Rails routes, the asset pipeline, Sass, and refactoring tests using RSpec.

Lesson 6: Modeling Users
This lesson demonstrates how to create a data model for the site users that also stores the data. You learn how to implement data validations and add a secure password to allow login and authentication.

Lesson 7: Sign Up
The development of the sample app continues by giving users the ability to sign up for the site and create a user profile. You also learn how to make a signup form with error messages for invalid submission and implement successful user registration for valid submission.

Lesson 8:
Now that new users can sign up for the site, it's time to give them the ability to log in and log out. In this lesson, you learn how to implement the simplest fully functional login model, which keeps users logged in for one session at a time, automatically expiring the sessions when users close their browsers.

Lesson 9:
In this lesson, you build on the login system from Lesson 8 to add the ability to remember the users' login status even after they close their browsers. You also learn how to automatically remember users, and then how to optionally remember them based on the value of a remember-me checkbox.

Lesson 11:
In Lesson 10, you finished making a basic user resource together with the flexible authentication and authorization system. In this lesson and the next, you learn how to put the finishing touches on this system, starting with an account activation feature that verifies each new user's email address. This will involve creating a new resource, thereby giving you a chance to see further examples of controllers, routing, and database migrations. In the process, you also learn how to send email in Rails, both in development and in production.

Lesson 12:
In this lesson, you learn how to give users the ability to reset their passwords if they forget them. The implementation closely parallels the account activations from Lesson 11, providing yet another example of creating a Rails resource from scratch, as well as a second example of sending email in production.

Lesson 13: User Microposts
This lesson demonstrates how to make a data model for short posts (“microposts”), make a page to show a list of microposts, and implement a web interface to create and delete microposts. We then learn how to upload images and associate them to microposts, including image resizing, format validations, and production deployment using a cloud storage service (S3).

Lesson 14: Following Users
The final lesson completes the core sample application by adding a social layer for users to follow and unfollow other users. You learn how to make a data model between users, give users the capability to follow each other through the web, and create a status feed of the microposts from the users.

About LiveLessons Video Training

The LiveLessons Video Training series publishes hundreds of hands-on, expert-led video tutorials covering a wide selection of technology topics designed to teach you the skills you need to succeed. This professional and personal technology video series features world-leading author instructors published by your trusted technology brands: Addison-Wesley, Cisco Press, IBM Press, Pearson IT Certification, Prentice Hall, Sams, and Que. Topics include: IT Certification, Programming, Web Development, Mobile Development, Home and Office Technologies, Business and Management, and more. View all LiveLessons on InformIT at http://www.informit.com/livelessons.

Table of Contents

  1. Introduction
    1. The Ruby on Rails Tutorial: Introduction 00:03:28
  2. Chapter 1: From zero to deploy
    1. Topics 00:00:34
    2. 1.1.0 Introduction 00:00:55
    3. 1.1.1 Prerequisites 00:00:40
    4. 1.1.2 Conventions used in this book 00:00:15
    5. 1.2.0 Up and running 00:00:54
    6. 1.2.1 Development environment 00:02:50
    7. 1.2.2 Installing Rails 00:01:30
    8. 1.3.0 The first application 00:02:37
    9. 1.3.1 Bundler 00:03:33
    10. 1.3.2 rails server 00:05:11
    11. 1.3.3 Model-View-Controller (MVC) 00:01:07
    12. 1.3.4 Hello, world! 00:04:10
    13. 1.4.0 Version control with Git 00:00:49
    14. 1.4.1 Installation and setup 00:04:28
    15. 1.4.2 What good does Git do you? 00:01:43
    16. 1.4.3 Bitbucket 00:07:27
    17. 1.4.4 Branch, edit, commit, merge 00:08:34
    18. 1.5.0 Deploying 00:00:21
    19. 1.5.1 Heroku setup 00:01:42
    20. 1.5.2 Heroku deployment, step one 00:01:11
    21. 1.5.3 Heroku deployment, step two 00:01:15
    22. 1.5.4 Heroku commands 00:01:01
    23. 1.6.0 Conclusion 00:00:58
  3. Chapter 2: A toy app
    1. Topics 00:00:42
    2. 2.1.0 Planning the application 00:07:09
    3. 2.1.1 A toy model for users 00:00:46
    4. 2.1.2 A toy model for microposts 00:00:46
    5. 2.2.0 The Users resource 00:02:56
    6. 2.2.1 A user tour 00:02:30
    7. 2.2.2 MVC in action 00:05:45
    8. 2.2.3 Weaknesses of this Users resource 00:01:48
    9. 2.3.0 The Microposts resource 00:02:59
    10. 2.3.1 A micropost microtour 00:01:08
    11. 2.3.2 Putting the micro in microposts 00:02:07
    12. 2.3.3 A user has_many microposts 00:05:44
    13. 2.3.4 Inheritance hierarchies 00:02:28
    14. 2.3.5 Deploying the toy app 00:04:03
    15. 2.4.0 Conclusion 00:00:48
  4. Chapter 3: Mostly static pages
    1. Topics 00:00:36
    2. 3.1.0 Sample app setup 00:14:44
    3. 3.2.0 Static pages 00:00:32
    4. 3.2.1 Generated static pages 00:08:10
    5. 3.2.2 Custom static pages 00:04:10
    6. 3.3.0 Getting started with testing 00:01:17
    7. 3.3.1 Our first test 00:03:13
    8. 3.3.2 Red 00:01:23
    9. 3.3.3 Green 00:06:34
    10. 3.3.4 Refactor 00:00:32
    11. 3.4.0 Slightly dynamic pages 00:02:20
    12. 3.4.1 Testing titles (Red) 00:02:28
    13. 3.4.2 Adding page titles (Green) 00:03:01
    14. 3.4.3 Layouts and embedded Ruby (Refactor) 00:10:03
    15. 3.4.4 Setting the root route 00:01:23
    16. 3.5.0 Conclusion 00:07:28
    17. 3.6.0 Advanced testing setup 00:00:53
    18. 3.6.1 minitest reporters 00:01:44
    19. 3.6.2 Automated tests with Guard 00:04:01
  5. Chapter 4: Rails-flavored Ruby
    1. Topics 00:00:31
    2. 4.1.0 Motivation 00:00:42
    3. 4.1.1 Built-in helpers 00:01:06
    4. 4.1.2 Custom helpers 00:07:09
    5. 4.2.0 Strings and methods 00:00:11
    6. 4.2.1 Comments 00:02:45
    7. 4.2.2 Strings 00:05:01
    8. 4.2.3 Objects and message passing 00:08:36
    9. 4.2.4 Method definitions 00:03:18
    10. 4.2.5 Back to the title helper 00:01:54
    11. 4.3.0 Other data structures 00:00:26
    12. 4.3.1 Arrays and ranges 00:11:27
    13. 4.3.2 Blocks 00:08:07
    14. 4.3.3 Hashes and symbols 00:13:36
    15. 4.3.4 CSS revisited 00:02:42
    16. 4.4.0 Ruby classes 00:00:28
    17. 4.4.1 Constructors 00:02:39
    18. 4.4.2 Class inheritance 00:07:11
    19. 4.4.3 Modifying built-in classes 00:03:24
    20. 4.4.4 A controller class 00:02:47
    21. 4.4.5 A user class 00:06:03
    22. 4.5.0 Conclusion 00:02:39
  6. Chapter 5: Filling in the layout
    1. Topics 00:00:40
    2. 5.1.0 Adding some structure 00:02:04
    3. 5.1.1 Site navigation 00:18:16
    4. 5.1.2 Bootstrap and custom CSS 00:09:18
    5. 5.1.3 Partials 00:09:34
    6. 5.2.0 Sass and the asset pipeline 00:00:17
    7. 5.2.1 The asset pipeline 00:02:29
    8. 5.2.2 Syntactically awesome stylesheets 00:09:04
    9. 5.3.0 Layout links 00:00:42
    10. 5.3.1 Contact page 00:03:16
    11. 5.3.2 Rails routes 00:04:09
    12. 5.3.3 Using named routes 00:01:31
    13. 5.3.4 Layout link tests 00:07:56
    14. 5.4.0 User signup: A first step 00:00:15
    15. 5.4.1 Users controller 00:01:37
    16. 5.4.2 Signup URL 00:01:57
    17. 5.5.0 Conclusion 00:01:56
  7. Chapter 6: Modeling users
    1. Topics 00:00:34
    2. 6.1.0 User model 00:01:11
    3. 6.1.1 Database migrations 00:10:07
    4. 6.1.2 The model file 00:00:42
    5. 6.1.3 Creating user objects 00:07:06
    6. 6.1.4 Finding user objects 00:04:26
    7. 6.1.5 Updating user objects 00:05:00
    8. 6.2.0 User validations 00:01:41
    9. 6.2.1 A validity test 00:03:17
    10. 6.2.2 Validating presence 00:05:43
    11. 6.2.3 Length validation 00:03:48
    12. 6.2.4 Format validation 00:16:34
    13. 6.2.5 Uniqueness validation 00:14:52
    14. 6.3.0 Adding a secure password 00:00:29
    15. 6.3.1 A hashed password 00:02:59
    16. 6.3.2 User has secure password 00:01:36
    17. 6.3.3 Minimum password standards 00:02:55
    18. 6.3.4 Creating and authenticating a user 00:06:46
    19. 6.4.0 Conclusion 00:05:02
  8. Chapter 7: Sign up
    1. Topics 00:00:40
    2. 7.1.0 Showing users 00:01:18
    3. 7.1.1 Debug and Rails environments 00:06:40
    4. 7.1.2 A Users resource 00:06:42
    5. 7.1.3 Debugger 00:03:45
    6. 7.1.4 A Gravatar image and a sidebar 00:16:53
    7. 7.2.0 Signup form 00:01:33
    8. 7.2.1 Using form_for 00:08:59
    9. 7.2.2 Signup form HTML 00:03:26
    10. 7.3.0 Unsuccessful signups 00:01:00
    11. 7.3.1 A working form 00:03:56
    12. 7.3.2 Strong parameters 00:06:58
    13. 7.3.3 Signup error messages 00:12:02
    14. 7.3.4 A test for invalid submission 00:09:27
    15. 7.4.0 Successful signups 00:00:41
    16. 7.4.1 The finished signup form 00:04:05
    17. 7.4.2 The flash 00:05:39
    18. 7.4.3 The first signup 00:04:39
    19. 7.4.4 A test for valid submission 00:03:55
    20. 7.5.0 Professional-grade deployment 00:01:19
    21. 7.5.1 SSL in production 00:01:34
    22. 7.5.2 Production webserver 00:03:24
    23. 7.5.3 Production deployment 00:01:49
    24. 7.6.0 Conclusion 00:00:35
  9. Chapter 8: Basic login
    1. Topics 00:00:23
    2. 8.1.0 Sessions 00:01:53
    3. 8.1.1 Sessions controller 00:00:54
    4. 8.1.2 Login form 00:09:29
    5. 8.1.3 Finding and authenticating a user 00:05:43
    6. 8.1.4 Rendering with a flash message 00:02:11
    7. 8.1.5 A flash test 00:04:54
    8. 8.2.0 Logging in 00:01:37
    9. 8.2.1 The log_in method 00:04:53
    10. 8.2.2 Current user 00:04:10
    11. 8.2.3 Changing the layout links 00:09:12
    12. 8.2.4 Testing layout changes 00:10:25
    13. 8.2.5 Login upon signup 00:03:05
    14. 8.3.0 Logging out 00:06:03
    15. 8.4.0 Conclusion 00:01:52
  10. Chapter 9: Advanced login
    1. Topics 00:00:22
    2. 9.1.0 Remember me 00:00:44
    3. 9.1.1 Remember token and digest 00:11:44
    4. 9.1.2 Login with remembering 00:13:37
    5. 9.1.3 Forgetting users 00:03:06
    6. 9.1.4 Two subtle bugs 00:07:14
    7. 9.2.0 “Remember me” checkbox 00:07:08
    8. 9.3.0 Remember tests 00:01:31
    9. 9.3.1 Testing the “remember me” box 00:07:37
    10. 9.3.2 Testing the remember branch 00:08:31
    11. 9.4.0 Conclusion 00:04:52
  11. Chapter 10: Updating, showing, and deleting users
    1. Topics 00:00:44
    2. 10.1.0 Updating users 00:01:51
    3. 10.1.1 Edit form 00:09:00
    4. 10.1.2 Unsuccessful edits 00:02:14
    5. 10.1.3 Testing unsuccessful edits 00:04:07
    6. 10.1.4 Successful edits (with TDD) 00:09:19
    7. 10.2.0 Authorization 00:01:14
    8. 10.2.1 Requiring logged-in users 00:10:10
    9. 10.2.2 Requiring the right user 00:11:12
    10. 10.2.3 Friendly forwarding 00:10:36
    11. 10.3.0 Showing all users 00:00:40
    12. 10.3.1 Users index 00:07:35
    13. 10.3.2 Sample users 00:05:25
    14. 10.3.3 Pagination 00:05:34
    15. 10.3.4 Users index test 00:08:08
    16. 10.3.5 Partial refactoring 00:03:16
    17. 10.4.0 Deleting users 00:00:27
    18. 10.4.1 Administrative users 00:06:17
    19. 10.4.2 The destroy action 00:06:38
    20. 10.4.3 User destroy tests 00:09:33
    21. 10.5.0 Conclusion 00:04:14
  12. Chapter 11: Account activation
    1. Topics 00:00:35
    2. 11.1.0 Account activations resource 00:00:45
    3. 11.1.1 Account activations controller 00:02:35
    4. 11.1.2 Account activation data model 00:10:03
    5. 11.2.0 Account activation emails 00:00:15
    6. 11.2.1 Mailer templates 00:09:21
    7. 11.2.2 Email previews 00:06:01
    8. 11.2.3 Email tests 00:06:36
    9. 11.2.4 Updating the Users create action 00:03:45
    10. 11.3.0 Activating the account 00:02:42
    11. 11.3.1 Generalizing the authenticated? method 00:07:01
    12. 11.3.2 Activation edit action 00:06:48
    13. 11.3.3 Activation test and refactoring 00:13:04
    14. 11.4.0 Email in production 00:05:53
    15. 11.5.0 Conclusion 00:00:24
  13. Chapter 12: Password reset
    1. Topics 00:00:22
    2. 12.1.0 Password resets resource 00:00:43
    3. 12.1.1 Password resets controller 00:03:40
    4. 12.1.2 New password resets 00:04:40
    5. 12.1.3 Password reset create action 00:08:12
    6. 12.2.0 Password reset emails 00:00:23
    7. 12.2.1 Password reset mailer and templates 00:04:51
    8. 12.2.2 Email tests 00:02:42
    9. 12.3.0 Resetting the password 00:00:28
    10. 12.3.1 Reset edit action 00:05:55
    11. 12.3.2 Updating the reset 00:15:11
    12. 12.3.3 Password reset test 00:23:28
    13. 12.4.0 Email in production (take two) 00:06:17
    14. 12.5.0 Conclusion 00:00:57
  14. Chapter 13: User microposts
    1. Topics 00:00:48
    2. 13.1.0 A Micropost model 00:00:36
    3. 13.1.1 The basic model 00:03:46
    4. 13.1.2 Micropost validations 00:05:28
    5. 13.1.3 User/Micropost associations 00:03:45
    6. 13.1.4 Micropost refinements 00:09:22
    7. 13.2.0 Showing microposts 00:00:37
    8. 13.2.1 Rendering microposts 00:08:49
    9. 13.2.2 Sample microposts 00:04:37
    10. 13.2.3 Profile micropost tests 00:11:23
    11. 13.3.0 Manipulating microposts 00:00:53
    12. 13.3.1 Micropost access control 00:06:09
    13. 13.3.2 Creating microposts 00:15:55
    14. 13.3.3 A proto-feed 00:09:33
    15. 13.3.4 Destroying microposts 00:05:49
    16. 13.3.5 Micropost tests 00:12:20
    17. 13.4.0 Micropost images 00:00:44
    18. 13.4.1 Basic image upload 00:05:58
    19. 13.4.2 Image validation 00:04:55
    20. 13.4.3 Image resizing 00:04:07
    21. 13.4.4 Image upload in production 00:09:26
    22. 13.5.0 Conclusion 00:00:32
  15. Chapter 14: Following users
    1. Topics 00:00:35
    2. 14.1.0 The Relationship model 00:01:43
    3. 14.1.1 A problem with the data model (and a solution) 00:06:29
    4. 14.1.2 User/relationship associations 00:04:42
    5. 14.1.3 Relationship validations 00:03:16
    6. 14.1.4 Followed users 00:08:28
    7. 14.1.5 Followers 00:03:45
    8. 14.2.0 A web interface for following users 00:00:40
    9. 14.2.1 Sample following data 00:02:43
    10. 14.2.2 Stats and a follow form 00:23:38
    11. 14.2.3 Following and followers pages 00:19:08
    12. 14.2.4 A working follow button the standard way 00:09:13
    13. 14.2.5 A working follow button with Ajax 00:14:20
    14. 14.2.6 Following tests 00:07:54
    15. 14.3.0 The status feed 00:00:39
    16. 14.3.1 Motivation and strategy 00:00:45
    17. 14.3.2 A first feed implementation 00:10:31
    18. 14.3.3 Subselects 00:08:07
    19. 14.4.0 Conclusion 00:00:47
  16. Summary
    1. The Ruby on Rails Tutorial: Summary 00:00:44