Apply Rails for agile web development - directory

xiaoxiao2021-04-03  228

table of Contents

Chapter 1 Introduction ... 1

1.1 Rails is agile ... 3

1.2 Read you need ... 4

Rails version ... 6

1.3 Acknowledgments ... 6

Thank you from Dave Thomas ... 7

Thanks from David HeineMeier Hansson ... 7

Chapter 2 Architecture of Rails Applications ... 11

2.1 Model, view, and controller ... 11

2.2 Active Record: Rails model support ... 15

Database-centric program design ... 15

Object / Relationship Mapping (ORM) ... 17

2.3 Action Pack: View and Controller ... 19

View support ... 19

Also ... controller! ... 19

Chapter 3 Install Rails. 21

3.1 Installation on Windows ... 21

3.2 Installation on Mac OS X ... 22

3.3 Installation on UNIX / Linux ... 22

3.4 Rails and database ... 23

3.5 Keep updates ... 26

3.6 Rails and ISP. 26

Chapter 4 is immediate ... 27

4.1 Creating a new application ... 27

4.2 Hello, Rails! 29

Rails and request URL. 30

Our first Action. 31

Let it move ... 33

4.3 Page chains ... 39

4.4 What did we do ... 43

Chapter 5 Depot Apps ... 47

5.1 incremental development ... 47

5.2 What do you do ... 48

Use case ... 48

Page stream ... 50

Data ... 52

5.3 Let's encode ... 53

Chapter 6 Task A: Goods Maintenance ... 53

6.1 iteration a1: Run up again ... 53

Create a Rails application ... 53

Create a database ... 54

Create a cargo table ... 54

Configure application ... 55

Create "goods maintenance" application ... 56

Rails Scaffolding ... 58

6.2 Iterative A2: Fill a missing field ... 61

6.3 Iterative A3: Check it! ... 64

6.4 iteration a4: american list page ... 67

What did we do ... 70

Chapter 7 Task B: Category Display ... 71

7.1 Iteration B1: Creating a Category List ... 71

7.2 iteration B2: Add page decoration ... 74

What did we do ... 77

Chapter 8 Task C: Create a shopping cart ... 79

8.1 session. 79

8.2 More Tables, More Models ... 81

8.3 Iterative C1: Create a shopping cart ... 83

Beautify shopping cart ... 89

8.4 Iterative C2: Processing error ... 91

Flash. 92

8.5 iterative C3: Complete shopping cart ... 95

What did we do ... 99

Chapter 9 Task D: Checkout! ... 101

9.1 Iterative D1: Get orders ... 102

Rails and forms ... 103

9.2 iteration D2: Show shopping cart content on payment page ... 110

What we did ... 114

Chapter 10 Tasks E: Shipping ... 115

10.1 iterative E1: Basic shipping function ... 115

What we did ... 123

Chapter 11 Task f: Management ... 125

11.1 Iterative F1: Add users ... 125

11.2 iteration F2: Login ... 130

11.3 Iterative F3: Access Control ... 132

No administrator ... ... 133

Update sidebar ... 134

Users log out ... 135

11.4 sweeping ... 136

11.5 add some cream on the cake ... 137 What did we do ... 138

Chapter 12 Task T: Test ... 139

12.1 plus test ... 139

12.2 Model Test ... 140

Your first test is already waiting for you ... 141

Database for testing ... 142

Test clamp ... 143

Create and read ... 145

Update ... 146

Destroy ... 147

Maintain test flexibility ... 148

Business rules for test model ... 149

Dynamic fixture ... 150

For sharing clamps ... 151

Test assistant ... 153

Custom assertion ... 154

12.3 Test of the controller ... 155

User login ... 155

Convenience tool for function test ... 159

I have already bought something! ... 163

12.4 Using Mock Objects ... 168

12.5 Test Drive Development ... 169

12.6 running test with RAKE ... 172

Create a test database ... 172

Run test ... 173

Arrange continuous construction ... 174

Generate statistics ... 174

12.7 Performance Test ... 175

Transactional fixture ... 177

Performance monitoring and evaluation ... 178

What did we do ... 178

Chapter 13 Inuting Rails. 181

13.1 Where is RAILS? ... 181

13.2 directory structure ... 181

13.3 Rails Configuration ... 185

Runtime environment ... 185

Configure database connection ... 186

Environment ... 187

Configuration parameters ... 188

13.4 naming conventions ... 188

Hybrid case, underscore, and plural form ... 188

Module controller ... 191

13.5 ACTIVE Support 192

Expansion of "quantity" ... 192

Time extension ... 193

String extension ... 194

13.6 Rails Log ... 194

13.7 debugging information ... 194

13.8 Wonderful Preview ... 196

Chapter 14 ActiveRecord foundation ... 1

14.1 tables and classes ... 1

14.2 fields and properties ... 2

Attribute access ... 4

Boolean type properties ... 4

Saving structured data ... 5

14.3 Primary key and ID .. 6

14.4 Connecting Database ... 7

14.5 crUd .. 8

New record ... 9

Read existing records ... 10

14.6 Interval Relation ... 19

Create foreign key ... 20

Specify association ... 21

One-on-one related ... 22

One-on-one related links ... 25

Multi-to-many associations ... 29

Self-referenced connection ... 31

Pre-read column record ... 32

Counter ... 33

14.7 transaction ... 34

Built-in transaction ... 38

Multi-database transaction ... 38

Chapter 15 Review ActiveRecord. 1

15.1 ACTS AS 1

ACTS AS LIST 1

ACTS As Tree. 3

15.2 polymerization ... 4

Composite object is a value object ... 8

15.3 single table inheritance ... 8

15.4 check ... 11

Calibration assist method ... 12

15.5 callback ... 17

Record timestamp ... 18

Tune Object ... 19

Observer 22

15.6 Advanced Properties ... 22

Façade field ... 24

15.7 Miscellaneous ... 25

Object ID .. 25

Use naked connection ... 25

When the ID is missing ... ... 26

Magic field ... 26

Chapter 16 ActionController and Rails. 289

16.1 Environment and Dependence ... 289

16.2 Foundation ... 290

16.3 Request Routing ... 291

URL generation ... 294

Controller named ... 298

Tiki route ... 301

16.4 Action Method ... 302

Controller environment ... 303

Answer ... 304

Template rendering ... 305

Send files and other data ... 308 redirection ... 309

16.5 Cookie and Session. 312

Rails session object ... 313

16.6 Flash - Action between Action ... 322

16.7 Filter and Calibration ... 324

Front / rear filter ... 324

Back filter and response tamper ... 326

Surround filter ... 327

Inheritance of the filter ... 327

Enter check ... 327

16.8 Cache initial contact ... 329

Cache What ... 331

Cache page failure strategy ... 332

16.9 Get request problem ... 335

Solve GET issues ... 336

Chapter 17 ActionView .. 339

17.1 template ... 339

Where is the template ... 339

Template's operating environment ... 340

What is the template ... 340

17.2 Builder Template ... 341

17.3 rhtml template ... 342

Side replacement ... 343

17.4 auxiliary method ... 344

Shared auxiliary method ... 346

17.5 Format auxiliary method ... 347

17.6 Link to another page or resource ... 349

17.7 Page ... 352

17.8 Form auxiliary method ... 353

Form auxiliary method ... 354

Field auxiliary method ... 354

RAILS application file upload ... 361

Error handling with model objects ... 364

Processing fields with model objects ... 365

17.9 layout and components ... 367

Layout ... 367

Looking for layout templates ... 368

Local page template ... 370

Component ... 373

17.10 Reopemony ... 377

Failure of cache clips ... 379

Storage options for fragment cache ... 380

17.11 New Template System ... 381

Create a dynamic template ... 382

Chapter 18 Web 2.0. 339

18.1 AJAX Profile ... 339

XMLHttpRequest 341

Ajax's "a". 341

18.2 Rails practices ... 342

LINK_TO_REMOTE. 343

FORM_REMOTE_TAG () 345

Observers. 346

Timed update ... 349

18.3 CONNERPRITED User Interface ... 350

Document object model operation ... 350

Visual effect ... 351

18.4 Senior Tips ... 355

Replacement technology ... 355

Talk again, callback ... 355

No need for Ajax visualization ... 361

Test ... 362

Backward compatibility ... 363

Web v2.1. 364

Chapter 19 ActionMailer. 411

19.1 Send Mail ... 411

Mail configuration ... 411

Send email ... 413

19.2 Receiving Mail ... 418

19.3 Email Test ... 420

Email unit test ... 420

Email function test ... 421

Chapter 20 Web Service and Rails. 423

20.1 What is AWS (and nothing) ... 423

20.2 API definition ... 424

Method signing ... 427

20.3 Distribution mode ... 429

Direct distribution ... 430

Hierarchical distribution ... 430

Delegation distribution ... 430

20.4 Use another distribution mechanism ... 432

Hierarchical distribution mode ... 432

Realize delegation distribution ... 433

20.5 Intercept method call ... 433

20.6 Web Service Test ... 435

External customer application (SOAP) ... 436

External customer application (XML-RPC) ... 436

20.7 Protocol Client ... 438

Chapter 21 Protecting Rails Applications ... 439

21.1 SQL injection ... 439

Defense SQL injection attack ... 440

Method for turning query into model objects ... 441

21.2 Cross-Site Script (CSS / XSS) ... 442 Typical Attack ... 442

Defense XSS attack ... 443

XSS attack using ECHO services ... 444

21.3 Defense Session Original Attack ... 445

21.4 Creating Records Directly from Form Parameters 446

21.5 Don't believe in ID parameters ... 447

21.6 Do not expose the controller method ... 448

21.7 file upload ... 450

21.8 Do not cache pages that require identity authentication ... 450

21.9 Knowings of each other ... 451

Chapter 22 Deployment and Telescopic ... 453

22.1 Select the release platform ... 453

Select web server ... 454

Select Servo mode ... 458

22.2 Trinity of the operating environment ... 461

Switch to the production environment ... 462

22.3 Iteration in the wilderness ... 463

Handling error ... 463

Release change ... 465

In console monitoring application ... 466

22.4 Maintenance ... 467

Log file ... 467

Cleaning session. 468

22.5 telescopic: no shared architecture ... 469

Provide all shared environments for Rails ... 469

22.6 Looking for and resolves the performance bottleneck ... 472

Use TAIL monitoring log ... 473

Beyond Tail 474

22.7 Case Analysis: Raved Rails 476 every day

37SIGNALS development Basecamp (www.basecamphq.com) ... 477

43 Things (www.43things.com) developed by Robot Co-OP ... 477

Mortgage Process Engine (www.rapidreporting.com ... 478

Appendix A Ruby Introduction ... 481

A.1 Ruby is an object-oriented language ... 481

A.2 Ruby Name ... 482

A.3 method ... 483

A.4 class ... 485

PRIVATE and PROTECTED. 487

A.5 module ... 487

A.6 array and haveh. 488

Hash and parameter list ... 489

A.7 control structure ... 489

A.8 Regular expression ... 490

A.9 code block and iterator ... 490

A.10 abnormal ... 491

A.11 Object Series ... 492

A.12 interactive Ruby. 492

A.13 Ruby ingredients ... 493

A.14 RDOC document ... 494

Appendix B configuration parameters ... 481

B.1 ActiveRecord configuration ... 481

B.2 ActionPack configuration ... 482

B.3 ActionMailer configuration ... 484

B.4 TestCase configuration ... 484

Appendix C Source code ... 481

C.1 Complete Depot Application ... 481

Database file ... 481

Auxiliary module ... 482

Unit test and function test ... 482

Performance test ... 482

CSS file ... 482

C.2 system prompts example ... 482

C.3 code example cross-reference ... 483

Appendix D Resource ... 481

D.2 Recommended Bibliography ... 481

Index ... 533

More exciting, please pay, please pay attention!

转载请注明原文地址:https://www.9cbs.com/read-131678.html

New Post(0)