27.02.2013 Views

Rails%203%20In%20Action

Rails%203%20In%20Action

Rails%203%20In%20Action

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

viii<br />

3<br />

4<br />

5<br />

6<br />

CONTENTS<br />

Developing a real Rails application 44<br />

3.1 Application setup 45<br />

The application story 45 ■ Version control 47 ■ The Gemfile<br />

and generators 50 ■ Database configuration 53 ■ Applying a<br />

stylesheet 54<br />

3.2 First steps 55<br />

Creating projects 55 ■ RESTful routing 60 ■ Committing<br />

changes 72 ■ Setting a page title 72 ■ Validations 76<br />

3.3 Summary 81<br />

Oh CRUD! 83<br />

4.1 Viewing projects 83<br />

Writing a feature 84 ■ The Factory Girl 85 ■ Adding a link to<br />

a project 86<br />

4.2 Editing projects 88<br />

The edit action 88 ■ The update action 90<br />

4.3 Deleting projects 91<br />

Writing a feature 92 ■ Adding a destroy action 92 ■ Looking<br />

for what isn’t there 93<br />

4.4 Summary 97<br />

Nested resources 99<br />

5.1 Creating tickets 99<br />

Nested routing helpers 100 ■ Creating a tickets controller 101<br />

Defining a has_many association 103 ■ Creating tickets within a<br />

project 104 ■ Finding tickets scoped by project 105 ■ Ticket<br />

validations 106<br />

5.2 Viewing tickets 108<br />

Listing tickets 110 ■ Culling tickets 111<br />

5.3 Editing tickets 112<br />

Adding the edit action 113 ■ Adding the update action 114<br />

5.4 Deleting tickets 115<br />

5.5 Summary 116<br />

Authentication and basic authorization 117<br />

6.1 What Devise does 118<br />

Installing Devise 118

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!