• No results found

Agile Web Development with Rails 4

N/A
N/A
Protected

Academic year: 2021

Share "Agile Web Development with Rails 4"

Copied!
8
0
0

Loading.... (view fulltext now)

Full text

(1)

Extracted from:

Agile Web Development with Rails 4

This PDF file contains pages extracted from Agile Web Development with Rails 4, published by the Pragmatic Bookshelf. For more information or to purchase a paperback or PDF copy, please visit http://www.pragprog.com. Note: This extract contains some colored text (particularly in code listing). This is available only in online versions of the books. The printed versions are black and white. Pagination might vary between the online and printer versions; the content is otherwise identical.

Copyright © 2010 The Pragmatic Programmers, LLC. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher.

The Pragmatic Bookshelf

(2)
(3)

Agile Web Development with Rails 4

Sam Ruby

Dave Thomas

David Heinemeier Hansson

The Pragmatic Bookshelf

(4)

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf, PragProg and the linking g device are trade-marks of The Pragmatic Programmers, LLC.

Every precaution was taken in the preparation of this book. However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein.

Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun. For more information, as well as the latest Pragmatic titles, please visit us at http://pragprog.com.

The team that produced this book includes: Susannah Pfalzer (editor)

Kim Wimpsett (copyeditor) David J Kelly (typesetter) Janet Furlow (producer) Juliet Benda (rights) Ellie Callahan (support)

Copyright © 2013 Pragmatic Programmers, LLC.

All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher. Printed in the United States of America.

ISBN-13: 978-1-937785-56-7 Printed on acid-free paper. Book version: P1.0—September 2013

(5)

Contents

Acknowledgments . . . ?

Introduction . . . ?

Part I — Getting Started

1. Installing Rails . . . ?

Installing on Windows ?

1.1

1.2 Installing on Mac OS X ?

1.3 Installing on Linux ?

1.4 Choosing a Rails Version ?

1.5 Setting Up Your Development Environment ?

1.6 Rails and Databases ?

2. Instant Gratification . . . ?

2.1 Creating a New Application ?

2.2 Hello, Rails! ?

2.3 Linking Pages Together ?

3. The Architecture of Rails Applications . . . ?

3.1 Models, Views, and Controllers ?

3.2 Rails Model Support ?

3.3 Action Pack: The View and Controller ?

4. Introduction to Ruby . . . ?

Ruby Is an Object-Oriented Language ?

4.1

4.2 Data Types ?

4.3 Logic ?

4.4 Organizing Structures ?

4.5 Marshaling Objects ?

4.6 Pulling It All Together ?

(6)

Part II — Building an Application

5. The Depot Application . . . ?

5.1 Incremental Development ?

5.2 What Depot Does ?

5.3 Let’s Code ?

6. Task A: Creating the Application . . . ?

6.1 Iteration A1: Creating the Products Maintenance

Application ?

6.2 Iteration A2: Making Prettier Listings ?

7. Task B: Validation and Unit Testing . . . ?

7.1 Iteration B1: Validating! ?

7.2 Iteration B2: Unit Testing of Models ?

8. Task C: Catalog Display . . . ?

Iteration C1: Creating the Catalog Listing ?

8.1

8.2 Iteration C2: Adding a Page Layout ?

8.3 Iteration C3: Using a Helper to Format the Price ?

8.4 Iteration C4: Functional Testing of Controllers ?

8.5 Iteration C5: Caching of Partial Results ?

9. Task D: Cart Creation . . . ?

9.1 Iteration D1: Finding a Cart ?

9.2 Iteration D2: Connecting Products to Carts ?

9.3 Iteration D3: Adding a Button ?

10. Task E: A Smarter Cart . . . ?

10.1 Iteration E1: Creating a Smarter Cart ?

10.2 Iteration E2: Handling Errors ?

10.3 Iteration E3: Finishing the Cart ?

11. Task F: Add a Dash of Ajax . . . ?

Iteration F1: Moving the Cart ?

11.1

11.2 Iteration F2: Creating an Ajax-Based Cart ?

11.3 Iteration F3: Highlighting Changes ?

11.4 Iteration F4: Hiding an Empty Cart ?

11.5 Iteration F5: Making Images Clickable ?

11.6 Testing Ajax Changes ?

(7)

12. Task G: Check Out! . . . ?

12.1 Iteration G1: Capturing an Order ?

12.2 Iteration G2: Atom Feeds ?

13. Task H: Sending Mail . . . ?

13.1 Iteration H1: Sending Confirmation Emails ?

13.2 Iteration H2: Integration Testing of Applications ?

14. Task I: Logging In . . . ?

Iteration I1: Adding Users ?

14.1

14.2 Iteration I2: Authenticating Users ?

14.3 Iteration I3: Limiting Access ?

14.4 Iteration I4: Adding a Sidebar, More Administration ?

15. Task J: Internationalization . . . ?

Iteration J1: Selecting the Locale ?

15.1

15.2 Iteration J2: Translating the Storefront ?

15.3 Iteration J3: Translating Checkout ?

15.4 Iteration J4: Add a Locale Switcher ?

16. Task K: Deployment and Production . . . ?

16.1 Iteration K1: Deploying with Phusion Passenger and

MySQL ?

16.2 Iteration K2: Deploying Remotely with Capistrano ?

16.3 Iteration K3: Checking Up on a Deployed Application ?

17. Depot Retrospective . . . ?

17.1 Rails Concepts ?

17.2 Documenting What We Have Done ?

Part III — Rails in Depth

18. Finding Your Way Around Rails . . . ?

18.1 Where Things Go ?

18.2 Naming Conventions ?

19. Active Record . . . ?

Defining Your Data ?

19.1

19.2 Locating and Traversing Records ?

19.3 Creating, Reading, Updating, and Deleting (CRUD) ?

19.4 Participating in the Monitoring Process ?

19.5 Transactions ?

(8)

20. Action Dispatch and Action Controller . . . ?

20.1 Dispatching Requests to Controllers ?

20.2 Processing of Requests ?

20.3 Objects and Operations That Span Requests ?

21. Action View . . . ?

Using Templates ?

21.1

21.2 Generating Forms ?

21.3 Processing Forms ?

21.4 Uploading Files to Rails Applications ?

21.5 Using Helpers ?

21.6 Reducing Maintenance with Layouts and Partials ?

22. Migrations . . . ?

Creating and Running Migrations ?

22.1

22.2 Anatomy of a Migration ?

22.3 Managing Tables ?

22.4 Advanced Migrations ?

22.5 When Migrations Go Bad ?

22.6 Schema Manipulation Outside Migrations ?

23. Nonbrowser Applications . . . ?

23.1 A Stand-Alone Application Using Active Record ?

23.2 A Library Function Using Active Support ?

24. Rails’ Dependencies . . . ?

Generating XML with Builder ?

24.1

24.2 Generating HTML with ERB ?

24.3 Managing Dependencies with Bundler ?

24.4 Interfacing with the Web Server with Rack ?

24.5 Automating Tasks with Rake ?

24.6 Survey of Rails’ Dependencies ?

25. Rails Plugins . . . ?

Credit Card Processing with Active Merchant ?

25.1

25.2 Beautifying Our Markup with Haml ?

25.3 Pagination ?

25.4 Finding More at RailsPlugins.org ?

26. Where to Go from Here . . . ?

A1. Bibliography . . . ?

Index . . . ?

References

Related documents

“I think the college experience shapes people in so many ways, and I think it’s important that people know a little bit at least about the school that they attend outside of

This gives a 1.5780-approximation algorithm for the s-t path TSP under the unit-weight graphical metric, and proves an upper bound of 1.6137 on the integrality gap of the

These findings are discussed further below in relation to the spatial distribution of endemic areas, the quality of predictive intermediate host traits (particularly genetic

They don’t have a positive expectation that something good is going to happen to them because of God’s great goodness.. I believe hope precedes and is connected

We pro- vide a complete analysis of the regularized model, e.g., existence of a global minimizer, invariance property, support recovery, and properties of block

Specifications where the dependent variable is time for child rearing and time for housework include: individual fixed effects, family type fixed effects, year fixed effects,

Tuition and fee information can be found in “Tuition and Fees” section of the catalog. Modular programs are offered throughout the year on a schedule independent of the

Delaware Department of Education, CACFP Procurement Page: https://www.doe.k12.de.us/Page/2788 Delaware Department of Education, SNP Procurement Page: