Ruby on Rails Tutorial: Learn Web Development with Rails, 7th Edition

Book description

"Ruby on RailsTM Tutorial Tutorial by Michael Hartl has become a must-read for developers learning how to build Rails apps."

--Peter Cooper, Editor of Ruby Inside

Used by sites as varied as Hulu, GitHub, Shopify, and Airbnb, Ruby on Rails is one of the most popular frameworks for developing web applications, but it can be challenging to learn and use. Whether you're new to web development or new only to Rails, Ruby on RailsTM Tutorial, Seventh Edition, is the solution.

Best-selling author and leading Rails developer Michael Hartl teaches Rails by guiding you through the development of three example applications of increasing sophistication. The tutorial's examples focus on the general principles of web development needed for virtually any kind of website. The updates to this edition include full compatibility with Rails 7.

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 while still being useful. Whatever your previous web-development experience, this book will guide you to true Rails mastery.

This book will help you

  • Set up your Rails development environment

  • Record version changes with Git and create a secure remote repository at GitHub

  • Deploy your applications early and often with Heroku

  • Go beyond generated code to truly understand how to build Rails applications from scratch

  • Learn testing and test-driven development (TDD)

  • Effectively use the Model-View-Controller (MVC) pattern

  • Structure applications using the REST architecture

  • Build static pages and transform them into dynamic ones

  • Master the Ruby programming skills all Rails developers need

  • Create high-quality site layouts and data models

  • Implement registration and authentication systems, including validation and secure passwords

  • Update, display, and delete users

  • Upload and display images using Active Storage and Amazon S3

  • Implement account activation and password reset, including sending email with Rails

  • Integrate JavaScript with Rails using Importmap

  • Add social features and microblogging, including an introduction to Hotwire and Turbo

Table of contents

  1. Cover Page
  2. About This eBook
  3. Halftitle Page
  4. Title Page
  5. Copyright Page
  6. Contents
  7. Foreword
  8. Preface
    1. Chapter by Chapter
    2. Additional Features
    3. Final Thoughts
    4. Learn Enough Scholarships
  9. Acknowledgments
  10. About the Author
  11. Chapter 1. From Zero to Deploy
    1. 1.1 Up and Running
    2. 1.2 The First Application
    3. 1.3 Version Control with Git
    4. 1.4 Deploying
    5. 1.5 Conclusion
    6. 1.6 Conventions Used in This Book
  12. Chapter 2. A Toy App
    1. 2.1 Planning the Application
    2. 2.2 The Users Resource
    3. 2.3 The Microposts Resource
    4. 2.4 Conclusion
  13. Chapter 3. Mostly Static Pages
    1. 3.1 Sample App Setup
    2. 3.2 Static Pages
    3. 3.3 Getting Started with Testing
    4. 3.4 Slightly Dynamic Pages
    5. 3.5 Conclusion
    6. 3.6 Advanced Testing Setup
  14. Chapter 4. Rails-Flavored Ruby
    1. 4.1 Motivation
    2. 4.2 Strings and Methods
    3. 4.3 Other Data Structures
    4. 4.4 Ruby Classes
    5. 4.5 Conclusion
  15. Chapter 5. Filling in the Layout
    1. 5.1 Adding Some Structure
    2. 5.2 Sass and the Asset Pipeline
    3. 5.3 Layout Links
    4. 5.4 User Signup: A First Step
    5. 5.5 Conclusion
  16. Chapter 6. Modeling Users
    1. 6.1 User Model
    2. 6.2 User Validations
    3. 6.3 Adding a Secure Password
    4. 6.4 Conclusion
  17. Chapter 7. Sign Up
    1. 7.1 Showing Users
    2. 7.2 Signup Form
    3. 7.3 Unsuccessful Signups
    4. 7.4 Successful Signups
    5. 7.5 Professional-Grade Deployment
    6. 7.6 Conclusion
  18. Chapter 8. Basic Login
    1. 8.1 Sessions
    2. 8.2 Logging In
    3. 8.3 Logging Out
    4. 8.4 Conclusion
  19. Chapter 9. Advanced Login
    1. 9.1 Remember Me
    2. 9.2 “Remember Me” Checkbox
    3. 9.3 Remember Tests
    4. 9.4 Conclusion
  20. Chapter 10. Updating, Showing, and Deleting Users
    1. 10.1 Updating Users
    2. 10.2 Authorization
    3. 10.3 Showing All Users
    4. 10.4 Deleting Users
    5. 10.5 Conclusion
  21. Chapter 11. Account Activation
    1. 11.1 Account Activations Resource
    2. 11.2 Account Activation Emails
    3. 11.3 Activating the Account
    4. 11.4 Email in Production
    5. 11.5 Conclusion
  22. Chapter 12. Password Reset
    1. 12.1 Password Resets Resource
    2. 12.2 Password Reset Emails
    3. 12.3 Resetting the Password
    4. 12.4 Email in Production (Take 2)
    5. 12.5 Conclusion
    6. 12.6 Proof of Expiration Comparison
  23. Chapter 13. User Microposts
    1. 13.1 A Micropost Model
    2. 13.2 Showing Microposts
    3. 13.3 Manipulating Microposts
    4. 13.4 Micropost Images
    5. 13.5 Conclusion
  24. Chapter 14. Following Users
    1. 14.1 The Relationship Model
    2. 14.2 A Web Interface for Following Users
    3. 14.3 The Status Feed
    4. 14.4 Conclusion
  25. Index
  26. Credits
  27. Code Snippets

Product information

  • Title: Ruby on Rails Tutorial: Learn Web Development with Rails, 7th Edition
  • Author(s): Michael Hartl
  • Release date: November 2022
  • Publisher(s): Addison-Wesley Professional
  • ISBN: 9780138050061