Agile Web Development with Rails: A Pragmatic Guide [Second Edition] 0977616630, 9780977616633

Rails is a full-stack, open source web framework that enables you to create full-featured, sophisticated web-based appli

230 53 7MB

English Pages 715 Year 2006

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
Contents......Page 5
Preface to the Second Edition......Page 12
Introduction......Page 14
Rails Is Agile......Page 16
Finding Your Way Around......Page 17
Acknowledgments......Page 19
Getting Started......Page 21
Models, Views, and Controllers......Page 22
Active Record: Rails Model Support......Page 25
Action Pack: The View and Controller......Page 29
Your Shopping List......Page 31
Installing on Windows......Page 32
Installing on Mac OS X......Page 34
Installing on Linux......Page 35
Development Environments......Page 36
Rails and Databases......Page 39
Rails and ISPs......Page 42
Creating a New Application......Page 43
Hello, Rails!......Page 45
Linking Pages Together......Page 56
What We Just Did......Page 59
Building an Application......Page 61
Incremental Development......Page 62
What Depot Does......Page 63
Let's Code......Page 67
Iteration A1: Get Something Running......Page 68
Iteration A2: Add a Missing Column......Page 79
Iteration A3: Validate!......Page 81
Iteration A4: Prettier Listings......Page 85
Iteration B1: Create the Catalog Listing......Page 94
Iteration B2: Add a Page Layout......Page 97
Iteration B3: Use a Helper to Format the Price......Page 99
Iteration B4: Linking to the Cart......Page 100
Sessions......Page 104
Iteration C1: Creating a Cart......Page 107
Iteration C2: A Smarter Cart......Page 110
Iteration C3: Handling Errors......Page 113
Iteration C4: Finishing the Cart......Page 118
Task D: Add a Dash of AJAX......Page 122
Iteration D1: Moving the Cart......Page 123
Iteration D2: An AJAX-Based Cart......Page 127
Iteration D3: Highlighting Changes......Page 131
Iteration D4: Hide an Empty Cart......Page 133
Iteration D5: Degrading If Javascript Is Disabled......Page 137
What We Just Did......Page 138
Iteration E1: Capturing an Order......Page 140
Iteration F1: Adding Users......Page 155
Iteration F2: Logging In......Page 163
Iteration F3: Limiting Access......Page 166
Iteration F4: A Sidebar, More Administration......Page 168
Generating the XML Feed......Page 175
Finishing Up......Page 182
Tests Baked Right In......Page 185
Unit Testing of Models......Page 186
Functional Testing of Controllers......Page 198
Integration Testing of Applications......Page 213
Performance Testing......Page 221
Using Mock Objects......Page 225
The Rails Framework......Page 228
Directory Structure......Page 229
Rails Configuration......Page 237
Naming Conventions......Page 241
Logging in Rails......Page 244
Debugging Hints......Page 245
What's Next......Page 247
Generally Available Extensions......Page 248
Enumerations and Arrays......Page 249
String Extensions......Page 250
Extensions to Numbers......Page 252
Time and Date Extensions......Page 253
An Extension to Ruby Symbols......Page 255
with_options......Page 256
Unicode Support......Page 257
Migrations......Page 263
Creating and Running Migrations......Page 264
Anatomy of a Migration......Page 266
Managing Tables......Page 270
Data Migrations......Page 275
Advanced Migrations......Page 278
When Migrations Go Bad......Page 280
Schema Manipulation Outside Migrations......Page 281
Managing Migrations......Page 282
Active Record: The Basics......Page 284
Columns and Attributes......Page 285
Primary Keys and IDs......Page 289
Connecting to the Database......Page 291
CRUD---Create, Read, Update, Delete......Page 296
Aggregation and Structured Data......Page 314
Miscellany......Page 321
Active Record: Relationships between Tables......Page 324
Creating Foreign Keys......Page 325
Specifying Relationships in Models......Page 327
belongs_to and has_xxx Declarations......Page 329
Joining to Multiple Tables......Page 344
Self-referential Joins......Page 354
Acts As......Page 355
When Things Get Saved......Page 359
Preloading Child Rows......Page 361
Counters......Page 362
Validation......Page 364
Callbacks......Page 374
Advanced Attributes......Page 381
Transactions......Page 384
The Basics......Page 393
Routing Requests......Page 394
Action Methods......Page 425
Cookies and Sessions......Page 436
Flash---Communicating between Actions......Page 446
Filters and Verification......Page 448
Caching, Part One......Page 456
The Problem with GET Requests......Page 463
Templates......Page 466
Using Helpers......Page 472
Helpers for Formatting, Linking, and Pagination......Page 473
How Forms Work......Page 481
Forms That Wrap Model Objects......Page 483
Custom Form Builders......Page 495
Working with Nonmodel Fields......Page 499
Uploading Files to Rails Applications......Page 502
Layouts and Components......Page 506
Caching, Part Two......Page 514
Adding New Templating Systems......Page 519
Prototype......Page 522
Script.aculo.us......Page 543
RJS Templates......Page 559
Conclusion......Page 566
Sending E-mail......Page 568
Receiving E-mail......Page 578
Testing E-mail......Page 580
What AWS Is (and What It Isn't)......Page 584
The API Definition......Page 585
Dispatching Modes......Page 590
Using Alternate Dispatching......Page 591
Method Invocation Interception......Page 593
Testing Web Services......Page 595
Protocol Clients......Page 598
Secure and Deploy Your Application......Page 599
SQL Injection......Page 600
Creating Records Directly from Form Parameters......Page 602
Don't Trust ID Parameters......Page 604
Don't Expose Controller Methods......Page 605
Cross-Site Scripting (CSS/XSS)......Page 606
Avoid Session Fixation Attacks......Page 608
File Uploads......Page 609
Don't Store Sensitive Information in the Clear......Page 610
Use SSL to Transmit Sensitive Information......Page 611
Knowing That It Works......Page 612
Deployment and Production......Page 614
Starting Early......Page 615
How a Production Server Works......Page 616
Comparing Front-End Web Servers......Page 618
Repeatable Deployments with Capistrano......Page 619
Setting Up a Deployment Environment......Page 620
Checking Up on a Deployed Application......Page 626
Production Application Chores......Page 627
Moving On to Launch and Beyond......Page 628
Appendices......Page 630
Ruby Is an Object-Oriented Language......Page 631
Ruby Names......Page 632
Methods......Page 633
Classes......Page 635
Modules......Page 637
Arrays and Hashes......Page 638
Control Structures......Page 639
Blocks and Iterators......Page 640
Exceptions......Page 641
Ruby Idioms......Page 642
RDoc Documentation......Page 644
Top-Level Configuration......Page 645
Active Record Configuration......Page 647
Action Controller Configuration......Page 649
Action View Configuration......Page 650
Action Mailer Configuration......Page 651
Test Case Configuration......Page 652
The Full Depot Application......Page 653
Bibliography......Page 684
A......Page 685
B......Page 690
C......Page 691
D......Page 693
E......Page 696
F......Page 697
H......Page 698
I......Page 699
L......Page 700
M......Page 701
N......Page 702
P......Page 703
R......Page 706
S......Page 709
T......Page 711
V......Page 713
W......Page 714
Z......Page 715

Agile Web Development with Rails: A Pragmatic Guide [Second Edition]
 0977616630, 9780977616633

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Recommend Papers