Foreword |
|
xi | |
Preface |
|
xiii | |
1 Starting Up Ruby on Rails |
|
1 | (12) |
|
If You Run Windows, You're Lucky |
|
|
2 | (1) |
|
Getting Started at the Command Line |
|
|
3 | (6) |
|
|
9 | (2) |
|
|
11 | (1) |
|
|
11 | (1) |
|
|
11 | (2) |
2 Rails on the Web |
|
13 | (14) |
|
|
13 | (4) |
|
What Are All Those Folders? |
|
|
17 | (1) |
|
|
18 | (2) |
|
|
20 | (2) |
|
|
22 | (2) |
|
|
24 | (1) |
|
|
24 | (1) |
|
|
24 | (3) |
3 Adding Web Style |
|
27 | (16) |
|
|
27 | (6) |
|
|
33 | (1) |
|
Creating a Layout for a Controller |
|
|
34 | (2) |
|
Choosing a Layout from a Controller |
|
|
36 | (2) |
|
Sharing Template Data with the Layout |
|
|
38 | (1) |
|
|
39 | (1) |
|
|
40 | (1) |
|
|
40 | (1) |
|
|
40 | (3) |
4 Managing Data Flow: Controllers and Models |
|
43 | (20) |
|
Getting Started, Greeting Guests |
|
|
43 | (5) |
|
|
48 | (1) |
|
Keeping Track: A Simple Guestbook |
|
|
49 | (8) |
|
Connecting to a Database Through a Model |
|
|
50 | (3) |
|
Connecting the Controller to the Model |
|
|
53 | (4) |
|
Finding Data with ActiveRecord |
|
|
57 | (4) |
|
|
61 | (1) |
|
|
61 | (1) |
|
|
62 | (1) |
5 Accelerating Development with Scaffolding and REST |
|
63 | (24) |
|
A First Look at Scaffolding |
|
|
63 | (5) |
|
REST and Controller Best Practices |
|
|
68 | (3) |
|
Websites and Web Applications |
|
|
68 | (2) |
|
Toward a Cleaner Approach |
|
|
70 | (1) |
|
Examining a RESTful Controller |
|
|
71 | (12) |
|
index: An Overview of Data |
|
|
76 | (1) |
|
show: Just One Row of Data and the Before Filter |
|
|
77 | (1) |
|
new: A Blank Set of Data Fields |
|
|
78 | (1) |
|
edit: Hand Me That Data, Please |
|
|
78 | (1) |
|
create: Save Something New |
|
|
79 | (2) |
|
Put This Updated Record In |
|
|
81 | (1) |
|
|
82 | (1) |
|
|
83 | (1) |
|
|
84 | (1) |
|
|
84 | (1) |
|
|
84 | (3) |
6 Presenting Models with Forms |
|
87 | (26) |
|
More Than a Name on a Form |
|
|
87 | (2) |
|
Generating HTML Forms with Scaffolding |
|
|
89 | (5) |
|
|
94 | (2) |
|
Creating Text Fields and Text Areas |
|
|
96 | (2) |
|
|
98 | (1) |
|
|
99 | (1) |
|
|
100 | (3) |
|
|
103 | (2) |
|
|
105 | (2) |
|
|
107 | (3) |
|
|
110 | (1) |
|
|
110 | (1) |
|
|
110 | (3) |
7 Strengthening Models with Validation |
|
113 | (18) |
|
|
113 | (3) |
|
|
116 | (1) |
|
The Power of Declarative Validation |
|
|
117 | (3) |
|
|
120 | (5) |
|
|
120 | (2) |
|
|
122 | (1) |
|
Testing Format with Regular Expressions |
|
|
122 | (1) |
|
|
123 | (1) |
|
|
123 | (2) |
|
|
125 | (1) |
|
|
125 | (1) |
|
Beyond Simple Declarations |
|
|
126 | (2) |
|
|
126 | (1) |
|
|
127 | (1) |
|
|
128 | (1) |
|
|
128 | (1) |
|
|
128 | (3) |
8 Improving Forms |
|
131 | (22) |
|
Adding a Picture by Uploading a File |
|
|
131 | (12) |
|
|
132 | (1) |
|
Model and Migration Changes |
|
|
133 | (5) |
|
|
138 | (5) |
|
Standardizing Your Look with Form Builders |
|
|
143 | (8) |
|
Supporting Your Own Field Types |
|
|
143 | (2) |
|
|
145 | (3) |
|
Integrating Form Builders and Styles |
|
|
148 | (3) |
|
|
151 | (1) |
|
|
151 | (1) |
|
|
152 | (1) |
9 Developing Model Relationships |
|
153 | (38) |
|
Connecting Awards to Students |
|
|
154 | (6) |
|
Establishing the Relationship |
|
|
155 | (1) |
|
Supporting the Relationship |
|
|
156 | (4) |
|
Connecting Students to Awards |
|
|
160 | (2) |
|
Removing Awards When Students Disappear |
|
|
160 | (1) |
|
Counting Awards for Students |
|
|
160 | (2) |
|
Nesting Awards in Students |
|
|
162 | (11) |
|
|
163 | (1) |
|
|
164 | (2) |
|
|
166 | (5) |
|
Connecting the Student Views |
|
|
171 | (1) |
|
|
172 | (1) |
|
Many-to-Many: Connecting Students to Courses |
|
|
173 | (14) |
|
|
173 | (1) |
|
|
174 | (2) |
|
Adding to the Controllers |
|
|
176 | (2) |
|
|
178 | (1) |
|
Supporting the Relationship Through Views |
|
|
178 | (9) |
|
|
187 | (1) |
|
|
188 | (1) |
|
|
188 | (1) |
|
|
188 | (3) |
10 Managing Databases with Migrations |
|
191 | (18) |
|
What Migrations Offer You |
|
|
192 | (1) |
|
|
193 | (4) |
|
|
193 | (2) |
|
Running Migrations Forward and Backward |
|
|
195 | (2) |
|
|
197 | (9) |
|
|
197 | (1) |
|
|
198 | (3) |
|
|
201 | (1) |
|
|
202 | (2) |
|
|
204 | (2) |
|
|
206 | (1) |
|
|
206 | (1) |
|
|
207 | (2) |
11 Debugging |
|
209 | (16) |
|
Creating Your Own Debugging Messages |
|
|
209 | (3) |
|
|
212 | (1) |
|
|
213 | (1) |
|
Working with Rails from the Console |
|
|
214 | (5) |
|
|
219 | (4) |
|
|
223 | (1) |
|
|
223 | (1) |
|
|
223 | (2) |
12 Testing |
|
225 | (26) |
|
|
225 | (1) |
|
|
226 | (1) |
|
Setting Up a Test Database with Fixtures |
|
|
227 | (4) |
|
|
231 | (7) |
|
|
238 | (7) |
|
|
241 | (1) |
|
|
241 | (2) |
|
Dealing with Nested Resources |
|
|
243 | (2) |
|
|
245 | (3) |
|
|
248 | (1) |
|
|
249 | (1) |
|
|
249 | (1) |
|
|
250 | (1) |
13 Sessions and Cookies |
|
251 | (12) |
|
Getting Into and Out of Cookies |
|
|
251 | (6) |
|
Storing Data Between Sessions |
|
|
257 | (5) |
|
|
262 | (1) |
|
|
262 | (1) |
|
|
262 | (1) |
14 Users and Authentication |
|
263 | (22) |
|
|
264 | (7) |
|
Wiring Authentication to Your Application |
|
|
271 | (2) |
|
|
273 | (10) |
|
|
283 | (1) |
|
|
284 | (1) |
|
|
284 | (1) |
|
|
284 | (1) |
15 Routing |
|
285 | (12) |
|
Creating Routes to Interpret URIs |
|
|
286 | (7) |
|
|
286 | (2) |
|
|
288 | (1) |
|
Regular Expressions and Routing |
|
|
289 | (1) |
|
A Domain Default with root |
|
|
289 | (1) |
|
|
290 | (1) |
|
|
291 | (1) |
|
|
292 | (1) |
|
|
292 | (1) |
|
Generating URIs from Views and Controllers |
|
|
293 | (2) |
|
Pointing url_for in the Right Direction |
|
|
293 | (1) |
|
|
294 | (1) |
|
|
295 | (1) |
|
|
296 | (1) |
|
|
296 | (1) |
|
|
296 | (1) |
16 From CSS to Sass |
|
297 | (12) |
|
|
297 | (1) |
|
|
298 | (5) |
|
|
298 | (2) |
|
|
300 | (2) |
|
|
302 | (1) |
|
Making Everything Work Together |
|
|
303 | (4) |
|
|
306 | (1) |
|
|
307 | (1) |
|
|
307 | (1) |
|
|
307 | (2) |
17 Managing Assets and Bundles |
|
309 | (12) |
|
|
309 | (9) |
|
|
310 | (1) |
|
|
310 | (1) |
|
|
311 | (4) |
|
|
315 | (3) |
|
|
318 | (1) |
|
|
318 | (1) |
|
|
319 | (2) |
18 Sending Code to the Browser: JavaScript and CoffeeScript |
|
321 | (10) |
|
Sending JavaScript to the Browser |
|
|
322 | (3) |
|
Simplifying with CoffeeScript |
|
|
325 | (4) |
|
Have Some Sugar with Your CoffeeScript |
|
|
325 | (2) |
|
Converting to CoffeeScript |
|
|
327 | (2) |
|
|
329 | (1) |
|
|
329 | (1) |
|
|
329 | (2) |
19 Mail in Rails |
|
331 | (12) |
|
|
331 | (6) |
|
|
337 | (1) |
|
|
338 | (4) |
|
|
338 | (1) |
|
|
339 | (3) |
|
|
342 | (1) |
|
|
342 | (1) |
|
|
342 | (1) |
20 Pushing Further into Rails |
|
343 | (8) |
|
Changing to Production Mode |
|
|
343 | (1) |
|
Deploying Is Much More Than Programming |
|
|
344 | (3) |
|
Joining the Rails Ecosystem |
|
|
347 | (4) |
|
|
347 | (1) |
|
|
348 | (1) |
|
Working with and Around Rails |
|
|
348 | (1) |
|
|
349 | (2) |
A An Incredibly Brief Introduction to Ruby |
|
351 | (22) |
B An Incredibly Brief Introduction to Relational Databases |
|
373 | (10) |
C An Incredibly Brief Guide to Regular Expressions |
|
383 | (10) |
D Glossary |
|
393 | (20) |
Index |
|
413 | |