Ruby on Rails Tutorial 4/e

Michael Hartl

買這商品的人也買了...

商品描述

<About>

Features
A thorough introduction to web development with Ruby on Rails
By widely respected Rails expert Michael Hartl, creator of RailsSpace and the Rails-based Inoshi social networking platform
Dramatically lowers the barrier to getting started with Rails
Fully updated for Rails 5

<Description>

“Ruby on Rails™ 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 Twitter, GitHub, Disney, 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 Rails™ Tutorial, Fourth 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 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 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 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 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

<Sample Content>

Table of Contents

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

商品描述(中文翻譯)

「<關於>」
功能
- 使用 Ruby on Rails 進行網頁開發的全面介紹
- 由廣受尊敬的 Rails 專家 Michael Hartl 撰寫,他是 RailsSpace 和基於 Rails 的 Inoshi 社交網絡平台的創建者
- 大幅降低學習 Rails 的門檻
- 完全更新至 Rails 5

「<描述>」
「Ruby on Rails™ 教程」已成為開發人員學習如何構建 Rails 應用程式的必讀之作。
- Peter Cooper,《Ruby Inside》編輯

Ruby on Rails 被 Twitter、GitHub、Disney 和 Airbnb 等各種網站使用,是最受歡迎的網頁應用程式開發框架之一,但學習和使用起來可能具有挑戰性。無論您是新手還是只對 Rails 新手,《Ruby on Rails™ 教程,第四版》都是解決方案。
- 知名作家和領先的 Rails 開發人員 Michael Hartl 通過引導您開發三個越來越複雜的示例應用程式來教授 Rails。本教程的示例重點關注網頁開發的一般原則,適用於幾乎任何類型的網站。本版的更新包括與 Rails 5 的完全兼容性,將最大的章節分為更易管理的單元,以及在每個章節中插入大量新的練習,以最大程度地強化材料。

這本不可或缺的指南不僅提供了整合的教程,還涵蓋了開發網頁應用程式所需的基本 Ruby、HTML、CSS 和 SQL 技能。Hartl 解釋了每種新技術如何解決實際問題,然後用簡單易懂但又有用的代碼進行演示。無論您之前有多少網頁開發經驗,本書都將引導您真正掌握 Rails。

本書將幫助您:
- 安裝和設置 Rails 開發環境,包括預安裝的雲端集成開發環境(IDE)
- 超越生成的代碼,真正理解如何從頭開始構建 Rails 應用程式
- 學習測試和測試驅動開發(TDD)
- 有效使用模型-視圖-控制器(MVC)模式
- 使用 REST 架構結構化應用程式
- 構建靜態頁面並將其轉換為動態頁面
- 掌握所有 Rails 開發人員所需的 Ruby 編程技能
- 創建高質量的網站佈局和數據模型
- 實現註冊和身份驗證系統,包括驗證和安全密碼
- 更新、顯示和刪除使用者
- 在生產環境中使用雲端存儲服務上傳圖片
- 實現帳戶激活和密碼重設,包括使用 Rails 發送電子郵件
- 添加社交功能和微博功能,包括介紹