Ruby on Rails Tutorial: Learn Web Development with Rails, 4th Edition
©2017 |Addison-Wesley Professional | Out of print
Michael Hartl
©2017 |Addison-Wesley Professional | Out of print
K-12 educators: This link is for individuals purchasing with credit cards or PayPal only. Contact your Savvas Learning Company Account General Manager for purchase options.
Best-selling author and leading Rails developer Michael Hartl teaches Rails by guiding readers 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 5, a division of the largest chapters into more manageable units, and a huge number of new exercises interspersed in each chapter for maximum reinforcement of the material.
This indispensable guide provides integrated tutorials not only for Rails, but also for the essential Ruby, HTML, CSS, and SQL skills needed 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 novel enough to be useful.
Praise for Michael Hartl’s Books and Videos on Ruby on Rails
“My former company (CD Baby) was one of the first to loudly switch to Ruby on Rails, and then even more loudly switch back to PHP. (Google me to read about the drama.) This book by Michael Hartl came so highly recommended that I had to try it, and the Ruby on Rails(TM) Tutorial is what I used to switch back to Rails again.”
–From the Foreword by Derek Sivers (sivers.org)
Formerly: founder of CD Baby
Currently: founder of Thoughts Ltd.
“Michael Hartl’s Rails Tutorial book is the #1 (and only, in my opinion) place to start when it comes to books about learning Rails. . . . It’s an amazing piece of work and, unusually, walks you through building a Rails app from start to finish with testing. If you want to read just one book and feel like a Rails master by the end of it, pick the Ruby on Rails(TM) Tutorial.”
–Peter Cooper, editor, Ruby Inside
“For the self-motivated reader who responds well to the ‘learn by doing’ method and is prepared to put in the effort, this comes highly recommended.”
–Ian Elliot, reviewer, I Programmer
“Ruby on Rails(TM) Tutorial is a lot of work, but if you’re careful and patient, you’ll learn a lot.”
–Jason Shen, tech entrepreneur, blogger at The Art of Ass-Kicking
“Michael Hartl’s Ruby on Rails(TM) Tutorial seamlessly taught me about not only Ruby on Rails, but also the underlying Ruby language, HTML, CSS, a bit of JavaScript, and even some SQL–but most importantly it showed me how to build a web application (Twitter) in a short amount of time.”
–Mattan Griffel, co-founder & CEO of One Month
“Although I’m a Python/Django developer by trade, I can’t stress enough how much this book has helped me. As an undergraduate, completely detached from industry, this book showed me how to use version control, how to write tests, and, most importantly–despite the steep learning curve for setting up and getting stuff running–how the end result of perseverance is extremely gratifying. It made me fall in love with technology all over again. This is the book I direct all my friends to who want to start learning programming/building stuff. Thank you Michael!”
–Prakhar Srivastav, software engineer, Xcite.com, Kuwait
“It doesn’t matter what you think you will be developing with in the future or what the framework du jour is; if you want to learn how to build something, there is no better place to start than with this tutorial. And for all the ‘non-technical’ people out there who want to see their ideas come to life, who are considering hiring contractors, paying for a class, or ‘founder dating’ in the search for a technical co-founder: stop. Take a step back. Forget about your idea for a short while and immerse yourself in this tutorial to learn what it takes to put something together. You and your software-related projects will be better for it.”
–Vincent C., entrepreneur and developer
“It has to be the best-written book of its type I’ve ever seen, and I can’t recommend it enough.”
–Daniel Hollands, administrator of Birmingham.IO
“For those wanting to learn Ruby on Rails, Hartl’s Ruby on Rails(TM) Tutorial is (in my opinion) the best way to do it.”
–David Young, software developer and author at deepinthecode.com
“This is a great tutorial for a lot of reasons, because aside from just teaching Rails, Hartl is also teaching good development practices.”
–Michael Denomy, full-stack web developer
“Without a doubt, the best way I learned Ruby on Rails was by building an actual working app. I used Michael Hartl’s Ruby on Rails(TM) Tutorial, which showed me how to get a very basic Twitter-like app up and running from scratch. I cannot recommend this tutorial enough; getting something up and going fast was key; it beats memorization by a mile.”
–James Fend, serial entrepreneur, JamesFend.com
“The book gives you the theory and practice, while the videos focus on showing you in person how it’s done. Highly recommended combo.”
–Antonio Cangiano, software engineer, IBM
“The author is clearly an expert at the Ruby language and the Rails framework, but more than that, he is a working software engineer who introduces best practices throughout the text.”
–Greg Charles, senior software developer, Fairway Technologies
“Overall, [Hartl’s] video tutorials should be a great resource for anyone new to Rails.”
–Michael Morin, ruby.about.com
“Hands-down, I would recommend this book to anyone wanting to get into Ruby on Rails development.”
–Michael Crump, Microsoft MVP
This product is part of the following series. Click on a series title to see the full list of products in the series.
Foreword to the First Edition by Derek Sivers xvii
Foreword to the Third Edition by Obie Fernandez xix
Acknowledgments xxi
About the Author xxiii
Chapter 1: From Zero to Deploy 1
1.1 Introduction 4
1.2 Up and Running 10
1.3 The First Application 14
1.4 Version Control with Git 31
1.5 Deploying 45
1.6 Conclusion 51
Chapter 2: A Toy App 53
2.1 Planning the Application 54
2.2 The Users Resource 58
2.3 The Microposts Resource 74
2.4 Conclusion 89
Chapter 3: Mostly Static Pages 93
3.1 Sample App Setup 93
3.2 Static Pages 99
3.3 Getting Started with Testing 110
3.4 Slightly Dynamic Pages 118
3.5 Conclusion 134
3.6 Advanced Testing Setup 136
Chapter 4: Rails-Flavored Ruby 145
4.1 Motivation 145
4.2 Strings and Methods 150
4.3 Other Data Structures 163
4.4 Ruby Classes 177
4.5 Conclusion 190
Chapter 5: Filling in the Layout 193
5.1 Adding Some Structure 193
5.2 Sass and the Asset Pipeline 217
5.3 Layout Links 227
5.4 User Signup: A First Step 240
5.5 Conclusion 245
Chapter 6: Modeling Users 247
6.1 User Model 248
6.2 User Validations 263
6.3 Adding a Secure Password 286
6.4 Conclusion 296
Chapter 7: Sign Up 299
7.1 Showing Users 300
7.2 Signup Form 320
7.3 Unsuccessful Signups 329
7.4 Successful Signups 345
7.5 Professional-Grade Deployment 358
7.6 Conclusion 362
Chapter 8: Basic Login 365
8.1 Sessions 366
8.2 Logging In 382
8.3 Logging Out 403
8.4 Conclusion 406
Chapter 9: Advanced Login 409
9.1 Remember Me 409
9.2 “Remember Me” Checkbox 433
9.3 Remember Tests 439
9.4 Conclusion 449
Chapter 10: Updating, Showing, and Deleting Users 451
10.1 Updating Users 451
10.2 Authorization 467
10.3 Showing All Users 483
10.4 Deleting Users 500
10.5 Conclusion 512
Chapter 11: Account Activation 515
11.1 Account Activations Resource 516
11.2 Account Activation Emails 525
11.3 Activating the Account 540
11.4 Email in Production 555
11.5 Conclusion 559
Chapter 12: Password Reset 561
12.1 Password Resets Resource 563
12.2 Password Reset Emails 574
12.3 Resetting the Password 581
12.4 Email in Production (Take Two) 595
12.5 Conclusion 598
12.6 Proof of Expiration Comparison 599
Chapter 13: User Microposts 601
13.1 A Micropost Model 601
13.2 Showing Microposts 616
13.3 Manipulating Microposts 631
13.4 Micropost Images 657
13.5 Conclusion 675
Chapter 14: Following Users 679
14.1 The Relationship Model 680
14.2 A Web Interface for Following Users 698
14.3 The Status Feed 730
14.4 Conclusion 741
Index 745
Pearson offers affordable and accessible purchase options to meet the needs of your students. Connect with us to learn more.
K12 Educators: Contact your Savvas Learning Company Account General Manager for purchase options. Instant Access ISBNs are for individuals purchasing with credit cards or PayPal.
Savvas Learning Company is a trademark of Savvas Learning Company LLC.
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.
We're sorry! We don't recognize your username or password. Please try again.
The work is protected by local and international copyright laws and is provided solely for the use of instructors in teaching their courses and assessing student learning.
You have successfully signed out and will be required to sign back in should you need to download more resources.