Agile Web Development with Rails, Third Edition

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

It's a good text, but it might be recommended that an Agile Development specific book be read, either beforehand or concurrently, while evolving the knowledge imparted in these pages. "The Art of Agile Development" by James Shore is a good compliment to this reading. Agile of course, does not only apply to Ruby and Rails, but Ruby and Rails are uniquely fashioned to promote Agile techniques. Prior Rails books do not illuminate this connection so well as this one does, if at all. As such, it can be more highly recommended to learn rails via this book as it exposes this connection through-out. As a context sensitive framework, rails can be learned to the degree of exposing just that much, or ... one might learn how to use rails in an fully iterative and collaborative development environment. That statement should clarify the import of this book. One might claim that there is a right way to learn Rails and well then too, the old way. Learn it the right way, using Agile Development practices. One quickly notes that Agile is not just a management tool, but a programmer's development methodology. In fact it transcends many development functions, from product management to testing, final release and continued maintenance and support. Rails as a framework, is enhanced by an understanding of how it fits with Agile. This book goes miles toward making that clear.

Author(s): Sam Ruby, Dave Thomas, David Heinemeier Hansson
Edition: 3
Publisher: Pragmatic Bookshelf
Year: 2009

Language: English
Pages: 762

Contents......Page 5
Preface to the Second Edition......Page 12
Preface to the Third Edition......Page 14
Introduction......Page 15
Rails Is Agile......Page 17
Finding Your Way Around......Page 18
Acknowledgments......Page 20
Getting Started......Page 22
Models, Views, and Controllers......Page 23
Active Record: Rails Model Support......Page 26
Action Pack: The View and Controller......Page 30
Installing on Windows......Page 32
Installing on Mac OS X......Page 34
Installing on Linux......Page 35
Choosing a Rails Version......Page 36
Development Environments......Page 37
Rails and Databases......Page 41
Rails and ISPs......Page 43
Creating a New Application......Page 44
Hello, Rails!......Page 46
Linking Pages Together......Page 57
What We Just Did......Page 60
Building an Application......Page 62
Incremental Development......Page 63
What Depot Does......Page 64
Let's Code......Page 68
Iteration A1: Get Something Running......Page 69
Create the Products Model and Maintenance Application......Page 75
Iteration A2: Add a Missing Column......Page 79
Iteration A3: Validate!......Page 84
Iteration A4: Prettier Listings......Page 89
Iteration B1: Create the Catalog Listing......Page 96
Iteration B2: Add a Page Layout......Page 100
Iteration B3: Use a Helper to Format the Price......Page 102
Iteration B4: Linking to the Cart......Page 103
Sessions......Page 107
Iteration C1: Creating a Cart......Page 111
Iteration C2: A Smarter Cart......Page 114
Iteration C3: Handling Errors......Page 117
Iteration C4: Finishing the Cart......Page 122
Task D: Add a Dash of AJAX......Page 127
Iteration D1: Moving the Cart......Page 128
Iteration D2: An AJAX-Based Cart......Page 133
Iteration D3: Highlighting Changes......Page 136
Iteration D4: Hide an Empty Cart......Page 139
Iteration D5: Degrading If Javascript Is Disabled......Page 142
What We Just Did......Page 143
Iteration E1: Capturing an Order......Page 145
Iteration F1: Adding Users......Page 161
Iteration F2: Logging In......Page 171
Iteration F3: Limiting Access......Page 174
Iteration F4: A Sidebar, More Administration......Page 177
Generating the XML Feed......Page 184
Finishing Up......Page 194
Iteration I1: Enabling Translation......Page 196
Iteration I2: Strategies for content......Page 211
Tests Baked Right In......Page 214
Unit Testing of Models......Page 215
Functional Testing of Controllers......Page 227
Integration Testing of Applications......Page 244
Performance Testing......Page 253
Using Mock Objects......Page 257
The Rails Framework......Page 260
Directory Structure......Page 261
Rails Configuration......Page 268
Naming Conventions......Page 272
Logging in Rails......Page 276
Debugging Hints......Page 277
What's Next......Page 278
Generally Available Extensions......Page 280
Enumerations and Arrays......Page 281
String Extensions......Page 283
Extensions to Numbers......Page 286
Time and Date Extensions......Page 287
An Extension to Ruby Symbols......Page 289
Unicode Support......Page 290
Migrations......Page 296
Creating and Running Migrations......Page 298
Anatomy of a Migration......Page 300
Managing Tables......Page 304
Data Migrations......Page 309
Advanced Migrations......Page 312
When Migrations Go Bad......Page 315
Schema Manipulation Outside Migrations......Page 316
Managing Migrations......Page 317
Active Record: The Basics......Page 319
Columns and Attributes......Page 320
Primary Keys and IDs......Page 324
Connecting to the Database......Page 326
CRUD---Create, Read, Update, Delete......Page 331
Aggregation and Structured Data......Page 350
Miscellany......Page 357
Active Record: Relationships between Tables......Page 361
Creating Foreign Keys......Page 362
Specifying Relationships in Models......Page 364
belongs_to and has_xxx Declarations......Page 366
Joining to Multiple Tables......Page 381
Self-referential Joins......Page 391
Acts As......Page 392
When Things Get Saved......Page 396
Preloading Child Rows......Page 398
Counters......Page 399
Validation......Page 401
Callbacks......Page 412
Advanced Attributes......Page 419
Transactions......Page 423
The Basics......Page 431
Routing Requests......Page 432
Resource-Based Routing......Page 448
Testing Routing......Page 464
Action Methods......Page 467
Cookies and Sessions......Page 479
Flash---Communicating between Actions......Page 489
Filters and Verification......Page 491
Caching, Part One......Page 499
The Problem with GET Requests......Page 508
Templates......Page 512
Using Helpers......Page 518
Helpers for Formatting, Linking, and Pagination......Page 520
How Forms Work......Page 527
Forms That Wrap Model Objects......Page 529
Custom Form Builders......Page 541
Working with Nonmodel Fields......Page 546
Uploading Files to Rails Applications......Page 549
Layouts and Components......Page 553
Caching, Part Two......Page 560
Adding New Templating Systems......Page 565
Prototype......Page 568
Script.aculo.us......Page 588
RJS Templates......Page 605
Conclusion......Page 612
Sending E-mail......Page 614
Receiving E-mail......Page 625
Testing E-mail......Page 627
Alternatives to ActiveResource......Page 630
Show me the Code!......Page 633
Relationships and Collections......Page 636
Pulling it all together......Page 638
Secure and Deploy Your Application......Page 641
SQL Injection......Page 642
Creating Records Directly from Form Parameters......Page 644
Don't Trust ID Parameters......Page 646
Don't Expose Controller Methods......Page 647
Cross-Site Scripting (CSS/XSS)......Page 648
Avoid Session Fixation Attacks......Page 650
File Uploads......Page 651
Don't Store Sensitive Information in the Clear......Page 652
Use SSL to Transmit Sensitive Information......Page 653
Knowing That It Works......Page 654
Starting Early......Page 656
How a Production Server Works......Page 657
Installing Passenger......Page 660
Worry free Deployment with Capistrano......Page 662
Checking Up on a Deployed Application......Page 666
Production Application Chores......Page 667
Moving On to Launch and Beyond......Page 669
Appendices......Page 671
Ruby Is an Object-Oriented Language......Page 672
Ruby Names......Page 673
Methods......Page 674
Classes......Page 676
Modules......Page 678
Arrays and Hashes......Page 679
Control Structures......Page 680
Blocks and Iterators......Page 681
Exceptions......Page 682
Ruby Idioms......Page 683
RDoc Documentation......Page 685
Top-Level Configuration......Page 686
Active Record Configuration......Page 688
Action Controller Configuration......Page 691
Action View Configuration......Page 692
Action Mailer Configuration......Page 693
Test Case Configuration......Page 694
The Full Depot Application......Page 695
Online Resources......Page 724
A......Page 726
C......Page 733
D......Page 737
E......Page 739
F......Page 740
H......Page 742
I......Page 743
L......Page 744
M......Page 745
N......Page 746
P......Page 747
R......Page 751
S......Page 754
T......Page 756
U......Page 758
V......Page 759
Z......Page 760