Ruby on Rails Tutorial : Learn Web Development with Rails
-Peter Cooper, Editor of Ruby Inside
Used by sites as diverse as Twitter, GitHub, Disney, and the Yellow Pages, 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 Rails (TM) Tutorial, Third 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, focusing on the fundamental techniques in web development needed for virtually any kind of application. The updates to this edition include simplified installation via a standard development environment in the cloud, use of the default Rails stack throughout, a light-weight testing approach, an all-new section on image upload, and an all-new chapter on account activation and password resets, including sending email with Rails.
This indispensable guide provides integrated tutorials not only for Rails, but also for the essential Ruby, HTML, CSS, and SQL skills you'll 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 novel enough to be useful. Whatever your previous web development experience, this book will guide you to true Rails mastery.
This book will help you
Install and set up your Rails development environment, including a pre-installed integrated development environment (IDE) in the cloud
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 images in production using a cloud storage service
Implement account activation and password reset, including sending email with Rails
Add social features and microblogging, including an introduction to Ajax
Record version changes with Git and create a secure remote repository at Bitbucket
Deploy your applications early and often with Heroku
- Paperback | 736 pages
- 179 x 231 x 39mm | 1,174g
- 09 May 2015
- Pearson Education (US)
- Addison-Wesley Educational Publishers Inc
- New Jersey, United States
- 3rd edition
Other books in this series
11 Oct 2012
Table of contents
Foreword to the Third Edition by Obie Fernandez xix
About the Author xxiii
Chapter 1: From Zero to Deploy 1
1.1 Introduction 4
1.2 Up and Running 8
1.3 The First Application 12
1.4 Version Control with Git 29
1.5 Deploying 41
1.6 Conclusion 47
1.7 Exercises 48
Chapter 2: A Toy App 51
2.1 Planning the Application 52
2.2 The Users Resource 55
2.3 The Microposts Resource 71
2.4 Conclusion 82
2.5 Exercises 84
Chapter 3: Mostly Static Pages 87
3.1 Sample App Setup 87
3.2 Static Pages 91
3.3 Getting Started with Testing 101
3.4 Slightly Dynamic Pages 111
3.5 Conclusion 124
3.6 Exercises 125
3.7 Advanced Testing Setup 127
Chapter 4: Rails-Flavored Ruby 137
4.1 Motivation 137
4.2 Strings and Methods 142
4.3 Other Data Structures 152
4.4 Ruby Classes 164
4.5 Conclusion 175
4.6 Exercises 176
Chapter 5: Filling in the Layout 179
5.1 Adding Some Structure 179
5.2 Sass and the Asset Pipeline 200
5.3 Layout Links 210
5.4 User Sign-up: A First Step 219
5.5 Conclusion 223
5.6 Exercises 225
Chapter 6: Modeling Users 227
6.1 User Model 228
6.2 User Validations 241
6.3 Adding a Secure Password 261
6.4 Conclusion 269
6.5 Exercises 271
Chapter 7: Sign Up 275
7.1 Showing Users 275
7.2 Sign-up Form 293
7.3 Unsuccessful Sign-ups 302
7.4 Successful Sign-ups 316
7.5 Professional-Grade Deployment 326
7.6 Conclusion 330
7.7 Exercises 331
Chapter 8: Log In, Log Out 335
8.1 Sessions 336
8.2 Logging In 351
8.3 Logging Out 368
8.4 Remember Me 371
8.5 Conclusion 404
8.6 Exercises 406
Chapter 9: Updating, Showing, and Deleting Users 411
9.1 Updating Users 411
9.2 Authorization 424
9.3 Showing All Users 440
9.4 Deleting Users 456
9.5 Conclusion 466
9.6 Exercises 468
Chapter 10: Account Activation and Password Reset 471
10.1 Account Activation 471
10.2 Password Reset 506
10.3 Email in Production 532
10.4 Conclusion 534
10.5 Exercises 536
10.6 Proof of Expiration Comparison 539
Chapter 11: User Microposts 541
11.1 A Micropost Model 541
11.2 Showing Microposts 555
11.3 Manipulating Microposts 568
11.4 Micropost Images 593
11.5 Conclusion 606
11.6 Exercises 609
Chapter 12: Following Users 613
12.1 The Relationship Model 614
12.2 A Web Interface for Following Users 630
12.3 The Status Feed 661
12.4 Conclusion 671
12.5 Exercises 673
"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, then 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
-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
About Michael Hartl