Prev | Current Page 480 | Next

Brad Ediger

"Advanced Rails"

It can be downloaded from http://
hgbook.red-bean.com/.
Matt Pelletier and Zed Shaw have written a book on Ruby application deployment
with Mongrel; it can be purchased and downloaded as a PDF from http://www.
awprofessional.com/bookstore/product.asp?isbn=0321483502&rl=1.
Ezra Zygmuntowicz is writing the book on Rails deployment. Information is available
at http://www.pragmaticprogrammer.com/titles/fr_deploy/index.html.
325
We??™d like to hear your suggestions for improving our indexes. Send email to index@oreilly.com.
Index
Symbols
$KCODE global variable, 73
%Self column, scanning profiles, 158
_( ) function, 251
Numbers
1+N problem, 166
8-bit Unicode Transformation Format
(UTF-8), 239
conversion, 248??“249
input, filtering, 244
servers, 248
storage, 245??“248
A
abstraction
bottom-up programming, 4
client security, 130??“135
Accept, 194
Accept-Charset header, 194
Accept-Encoding, 194
Accept-Language header, 194
access
concurrent, 297
files, merging, 298
instance variables, 58
access control lists (ACLs), 232
accessors, attributes, 62
account_location plugin, 85??“87
ACID transactions, 100
ACLs (access control lists), 232
Action Profiler, 153
Action Web Service (see AWS)
ActionController, 92
ActionMailer, 183
incorporating, 287??“289
actions
benchmarking, 163
caching, 177
profiling, 155??“157
RESTful Rails URI conventions, 199
ActionView, RESTful Rails, 216
Active Record pattern versus ActiveRecord
library, 271
ActiveLDAP library, 124
ActiveMerchant module, 35
ActiveRecord
alternatives, 271??“281
bottom-up programming and, 4
incorporating, 284??“287
migration, 285
models, 315
performance, 165
1+N problem, 166
indexing, 167??“171
SQL, 165
ActiveRecordStore, 174
ActiveResource, 223??“230
ActiveSupport, 57
Core Extensions, 60??“75
dependencies, 57
deprecation, 58
Inflector, 59
JSON, 59
multibyte character support, 242
Whiny Nil, 60
adding functionality to existing methods, 32
326 | Index
address book, Globalize example of, 258??“268
advanced database features, 109??“116
aggregators, 39
AJAX, secure fallback, 135
alias_method method, 34
aliasing, 70
all? predicate, 37
alternative template engines, 282??“284
Amazon S3 (Simple Storage Service) case
study, 231??“235
Ambition, 273
American Standard Code for Information
Interchange (see ASCII)
analysis, black-box, 148??“151
ANALYZE TABLE command, 171
anonymous functions, 36
any? predicate, 37
AOP (aspect-oriented programming), 32
Apache Portable Runtime (APR), 299
Apache servers, 318
application databases, 109
application_backtrace method, 66
applications
ActionMailer, 183
ActiveRecord, applying in, 287
ActiveSupport, 57
Core Extensions, 60??“75
dependencies, 57
deprecation, 58
Inflector, 59
JSON, 59
Whiny Nil, 60
architecture scalability, 173??“181
benchmarking, 161??“164
Borges, 26
DabbleDB, 27
Heckle, 2
importing, 309
initialization, 75
L10n (localization), 250
Globalize example, 258??“268
interface/resource
translation, 250??“255
locale-specific settings, 256
model translation, 257
Mongrel, 78, 108
multi-application projects, 313??“315
Seaside, 26
security design, 127??“137
servers, 319
state, 195
APR (Apache Portable Runtime), 299
architecture
Amazon S3 (Simple Storage Service) case
study, 233
MySQL Cluster, 122
Representational State Transfer (REST)
benefits of, 205??“209
overview of, 185??“187
representations, 193??“195
resources, 190??“193
RESTful Rails, 209??“231
statelessness, 195??“205
verbs, 187??“190
scalability, 173??“181
security
canonicalization, 143
cross-site request forgery
(CSRF), 141??“143
cross-site scripting (XSS), 139??“141
sessions, 137??“139
web issues, 137??“144
shared-nothing, 197
Array methods
*, 46
extract_options!, 61
in_groups_of, 61
pack, 46
rand, 61
split, 61
to_s, 61
to_sentence, 61
to_xml, 61
arrays
core extensions, 61
grouping, 61
methods, 46
ASCII (American Standard Code for
Information Interchange), 237
aspect-oriented programming (AOP), 32
asset hosts, 319
asynchronous replication, 124
atomic commits, 298
attachment handling, 107
attachment_fu library, 107
attacks
cross-site request forgery (CSRF), 141
cross-site scripting (XSS), 139
rainbow, 128
SQL injection, 144
TCP sequence-number prediction, 138
(see also security)
attr_accessible method, 132
attr_accessor method, 276
Index | 327
attr_protected method, 132
attributes
accessors, 62
configuration, 75
inheritance, 62
authenticated function, 131
authentication, 127??“130, 290
Amazon S3 (Simple Storage Service) case
study, 232
hash message authentication code
(HMAC), 143
HTTP Authentication plugin, 89
LDAP (Lightweight Directory Access
Protocol), 125
message authentication code (MAC), 134
Representational State Transfer
(REST), 204
authorization, 290
autoprops, Subversion, 309
AutoTest, 322
availability, 292
high, 120??“124
average, 148
AWS (Action Web Service), 231
B
backtrace (bt) command, 53
Basic Multilingual Plane (BMP), 240
before_save callback method, 130
Benchmark, code timing, 151??“153
benchmarking, 161??“164
benefits of Representational State Transfer
(REST), 205??“209
bidirectional text, 238
Binding class, 27
bindings, 27
black-box analysis, 148??“151
blacklists, 137
blank? method, 62
BLOB (see large/binary objects)
blocks
code procs, 20??“23
RESTful Rails, 218
BMP (Basic Multilingual Plane), 240
Borges, 26
bottom-up programming, 3
branches, 297
branching, 301??“306
buckets, 231
Bugzilla, 308
business logic constraints, 110
BYTEA data type, 102
C
C, writing inline code, 182
Cache-Control header, 208
caching
action, 177
constraints, 186
custom, 221
databases, 119
fragment, 178
Hypertext Transfer Protocol (HTTP),
RESTful Rails, 219??“222
page, 177
performance, 176
Representational State Transfer
(REST), 206
sweepers, 180
calculations
statistical, 65
time, 64
call stacks
continuations, 25??“27
reading, 50
call_stack_off function, 51
call_stack_on function, 51
Calls columns, scanning profiles, 158
canonicalization, 143
Unicode, 243
Capistrano, 321
centralized version control, 296??“299
chaining, methods, 33
chains, method lookup, 7
character encodings, 237
characters
compatibility, 243
composition, 243
encodings
ASCII, 237
Unicode, 238??“249
multibyte support, 242
precomposed, 243
checkout, 297
Chinese language, 238
Class#const_missing method, 57
class_def method, 18
classes
attribute accessors, 62
Binding, 27
DelegateClass, 30
Dispatcher, 77
Hash, 67
inheritable attributes, 62
328 | Index
classes (continued)
inheritance, method lookups, 6
instantiation, method lookups, 7
opening, 31
overview of, 4
proxy, delegation with, 30
singleton, 12??“14
of class objects, 14??“17
subclassing, 32
variables, 19
virtual, 13
clean_backtrace method, 66
clean_message method, 66
clients
Action Web Service (AWS), 231
Amazon S3 (Simple Storage Service) case
study, 234
security, 130??“135
client-server constraint, 185
client-side validation, 133
CLOB (see large/binary objects)
cloning trunks, 303
closures, 22
clusters
MySQL, 121
Oracle Real Application Clusters
(RAC), 124
PostgreSQL, 123
code, 2
ActiveSupport, 57
Core Extensions, 60??“75
dependencies, 57
deprecation, 58
Inflector, 59
JSON, 59
Whiny Nil, 60
adding, 31
bindings, 27
C, writing inline, 182
duplication, 2
hash message authentication code
(HMAC), 143
message authentication code (MAC), 134
metaprogramming, 1??“4
on-the-fly, writing, 24
passwords, hashing, 128
procs, 20??“23
reading, 49??“57
revision, downloading, 297
routing, 43
searching, 49
timing, 151??“153
code examples, xi
code reviews, contributing to Rails, 292
code-on-demand constraint, 186
Collaboa, 308
collect method (see map method)
commands
ANALYZE TABLE, 171
backtrace (bt), 53
help, 54
hg heads, 304
irg, 54
list, 53
OPTIMIZE TABLE, 171
perf_run, 163
script/plugin tool, 80??“83
svn import, 309
update, 297
VACUUM ANALYZE, 171
compatibility characters, 243
components
incorporating, 284
ActionMailer, 287??“289
ActiveRecord, 284??“287
replacing
ActiveRecord, 271??“281
alternative template engines, 282??“284
composite keys, 112??“114
composition, characters, 243
concurrent access, 297
Concurrent Versions System (CVS), 297
conditional GET, 207
confidence interval, 150
confidentiality, 137
configuration, 75
ActionMailer, 287??“289
locale-specific settings, 256
ObjectGraph (Og), 279
security, applications, 127??“137
Subversion, 309
X-Sendfile, 106
connections
Magic Multi-Connections gem, 118
multiple databases, 116??“118
constants, 4
constraints
caches, 186
client-server, 185
code-on-demand, 186
databases, 110
layered system, 186
stateless, 186
uniform interface, 186
Index | 329
consuming RESTful services, 223??“230
content negotiation, 194
content types, 193??“195
RESTful Rails, 217??“219
continuations, 25??“27
continuous integration, 321
contributing to Rails, 289??“295
conversion
8-bit Unicode Transformation Format
(UTF-8), 248??“249
date and time, 64
numeric, 71
cookies, 131, 134
cookie-based sessions, 138
cross-site request forgery (CSRF), 141
CookieStore, 134, 176
limitations of, 138
copy-modify-merge model, 297
Core Extensions, 60??“75
arrays, 61
blank? method, 62
class attribute accessors, 62
class inheritable attributes, 62
date and time formats, 63
files, 66
floating-point numbers, 66
hashes, 67
integers, 69
introspection, 70
kernels, 69
modules, 70
numeric conversions, 71
objects, 71
option processing, 61
ranges, 72
strings, 72
TimeZone, 75
create, read, update, delete (CRUD)
operations, 133
cross-site request forgery (CSRF), 141??“143
cross-site scripting (XSS), 139??“141
CRUD (create, read, update, delete)
operations, 133
CruiseControl, 322
cryptography, Kerckhoffs??™ principle, 135
CSRF (cross-site request forgery), 141??“143
customization
caching, 221
Rake tasks, 288
resource routes, 213
CVS (Concurrent Versions System), 297
D
DabbleDB, 27
daemons, 69
memcached, 175
pg_autovacuum, 171
data partitioning, 115
databases
8-bit Unicode Transformation Format
(UTF-8), 245
advanced features, 109??“116
application versus integration, 109
caching, 119, 176
action, 177
fragment, 178
page, 177
sweepers, 180
composite keys, 112??“114
constraints, 110
database management systems
(DBMSs), 96
MySQL, 98
Oracle, 100
PostgreSQL, 97
SQL Server, 100
SQLite, 100
dependencies, testing plugin, 93
high availability, 120??“124
indexing, performance, 167??“171
large/binary objects, 101??“109
Lightweight Directory Access Protocol
(LDAP), 124
load balancing, 120??“124
migration, 306??“308
multiple, connecting, 116??“118
ObjectGraph (Og), 279
passwords, hashing, 128, 129
performance, 171
query plans, 171??“173
rules, 114
SQL injection attacks, 144
storage, 102
stored procedures, 114
triggers, 114
DataMapper library, 272
dates
conversions, 64
formats, 63
DBMSs (database management systems), 96
MySQL, 98
Oracle, 100
330 | Index
DBMSs (continued)
PostgreSQL, 97
SQL Server, 100
SQLite, 100
Deadlock Retry plugin, 93
debugging, 52??“56
decentralized version control, 82, 299??“301
decoupling ActiveRecord, 284
delegate method, 70
DelegateClass class, 30
delegation with proxy classes, 30
DELETE method, 190
deleting large objects, 115
dependencies, 57
databases, testing plugin, 93
deployment, 315
application server, 319
Capistrano, 321
continuous integration, 321
front end web server, 317??“319
shared-nothing scalability, 316??“317
Vlad the Deployer, 321
deprecate method, 58
deprecation, 58
design, application security, 127??“137
detect method, 37
developer branches, 303
development styles, 49
digest authentication, statelessness, 204
Dir methods, 47
directories
plugins, 83
structure of plugins, 83
test/fixtures, 94
traversal, 144
disabling ActiveRecord, 271
Dispatcher class, 77
Distributed Ruby (DRb), 109
domain-specific languages (DSLs), 25
Don??™t Repeat Yourself (DRY principle), 2
double-dot problem, 144
DRb (Distributed Ruby), 109
DRbStore, 179
DRY principle (Don??™t Repeat Yourself), 2
DrySQL library, 111
DSLs (domain-specific languages), 25
duplication, 2
E
each_with_index method, 39
East Asian languages, 238
eigenclasses
(see also singleton classes)
email
ActionMailer, 183, 287??“289
receiving, 289
emulation, methods, 217
encapsulation, 4
encodings, character, 237
ASCII, 237
Unicode, 238??“249
engines, 290
Entity Tags (ETags), 207, 219
entries method, 39
Enumerable methods
all?, 47
grep, 47
sort_by, 47
Enumerable module, 37
Enumerator, 39
environments
initialization, 311
security, 145
equivalence, 244
error messages, security, 136
escape function, 249
establish_connection function, 284
etag method, 221
ETags (see Entity Tags)
evaluation of code bindings, 27
EWKB (extended well-known binary), 159
exceptions
methods, 66
TamperedWithCookie, 134, 138
existing applications, importing, 309
existing methods, adding functionality to, 32
expire_fragment method, 180
EXPLAIN keyword, 171
expressions, S-expressions, 2
extended well-known binary (EWKB), 159
extended-ASCII character sets, 238
extensions, 315
Mercurial Queues (MQ), 161
Multipurpose Internet Mail Extensions
(MIME), 209
Uniform Resource Identifiers (URIs), 193
external programs, leveraging, 182
externals, 310
Index | 331
F
fallback, security, 135
FastCGI handler (RailsFCGIHandler), 78
feature branches, 303
Ferret library, 170
fields, hidden form, 133
File methods
expand_path, 144
join, 47
open, 47
files
access, merging, 298
Core Extensions, 66
dependencies, 57
.


Pages:
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489