BUY THIS BOOK
Add to Cart

Print Book $34.99


Add to Cart

Print+PDF $45.49

Add to Cart

PDF $27.99

Safari Books Online

What is this?

Add to UK Cart

Print Book £21.99

What is this?

Looking to Reprint or License this content?


Advanced Rails
Advanced Rails By Brad Ediger

Cover | Table of Contents | Colophon


Index


[ Symbols ], 
[ Numbers ], 
[ A ], 
[ B ], 
[ C ], 
[ D ], 
[ E ], 
[ F ], 
[ G ], 
[ H ], 
[ I ], 
[ J ], 
[ K ], 
[ L ], 
[ M ], 
[ N ], 
[ O ], 
[ P ], 
[ Q ], 
[ R ], 
[ S ], 
[ T ], 
[ U ], 
[ V ], 
[ W ], 
[ X ], 
[ Z ], 


Symbols[ Top ]
$KCODE global variable, 73
%Self column, scanning profiles, 158
_( ) function, 251

Numbers[ Top ]
1+N problem, 166
8-bit Unicode Transformation Format (UTF-8), 239
      conversion, 248-249
      input, filtering, 244
      servers, 248
      storage, 245-248

A[ Top ]
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
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
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[ Top ]
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[ Top ]
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
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
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[ Top ]
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
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[ Top ]
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

F[ Top ]
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
      .mo, 252
      plugins, 83
      .pot, 251
      static, asset hosts for, 319
      text, copy-modify-merge model, 297
      translation, creating, 253
      X-Sendfile, sending data with, 105
FileStore, 174, 179
filesystems, storage, 103
filtering, 37
      8-bit Unicode Transformation Format (UTF-8), 244
find method, 37
find_all method, 37
find_with_attributes method, 281
finding code in the Rails framework, 49
first-class functions, 36
flags, 5
flat profiles, 158
floating-point numbers, 66
foreign key indexes, 168
forms
      hidden fields, 133
      parameters, 131
      processing, 132
Forwardable, 31
fragments
      caching, 178
      expiration, 180
framework_backtrace method, 66
front end web server, 317-319
full-text indexing, 99, 169
functional programming, 36-41
functionality, adding to existing methods, 32
functions
      _( ), 251
      anonymous, 36
      authenticated, 131
      call_stack_off, 51
      call_stack_on, 51
      escape, 249
      establish_connection, 284
      higher-order, 36
      if_modified, 221
      lambda, 23
      local_request?, 136
      method_missing, 17
      sendfile, 104

G[ Top ]
garbage collection
      Benchmark library, 152
      methods, 29
gems (see RubyGems)
generative programming, 24
GeoKit library, 170
GET method, 143, 188
gettext, 250-253
Gibberish, 253-254
global searches, 56
global variables, 19
Globalize, 254, 257
      example of, 258-268
glyphs, 239
GNU gettext, 250-253
GOTO construct, 26
graceful degradation, 135
grapheme, 239
grep method, 38
grouping arrays, 61

H[ Top ]
Haml, 283
Han characters, 239
Han unification, 241
Hash class, 67
hash message authentication code (HMAC), 143
Hash methods
      assert_valid_keys, 68
      delete, 48
      diff, 67
      from_xml, 67
Hash methods (continued)
      new, 47
      slice, 68
      stringify_keys, 67
      to_xml, 67
hashes
      Core Extensions, 67
      passwords, 128, 129
      salting, 128
HashWithIndifferentAccess, 68
HEAD method, 189
headers
      Referer, 131
      User-Agent, 131
Heckle, 2
help command, 54
helpers, fragment caching, 180
hg heads command, 304
hidden form fields, 133
high availability, 120-124
higher-order functions, 36
hijacking sessions, 138
HMAC (hash message authentication code), 143
hosts, asset, 319
HTTP (Hypertext Transfer Protocol)
      Authentication plugin, 89
      caching, RESTful Rails, 219-222
      client security, 130-135
      methods, 189
      response status codes, 222
      state, 196
httperf, black-box performance measurement with, 151
hypermedia as driver of application state, 193

I[ Top ]
i18n (internationalization), 236, 290
      character encodings, 237
            ASCII, 237
            Unicode, 238-249
      locale, 236
ICLASS, 9
idempotent methods, 189
if_modified function, 221
If-No-Match header, 207
image_path method, 319
ImageScience, 107
implementation
      continuations, 25-27
      ObjectSpace, 276
      partitioning, 115
importing applications, 309
include? method, 37
inclusion of modules, method lookups, 8-12
incorporating components, 284
      ActionMailer, 287-289
      ActiveRecord, 284-287
Independent Migrations plugin, 307
indexing
      foreign key indexes, 168
      full-text, 99, 169
      performance, 167-171
      spatial indexes, 170
      statistics, updating, 171
Inflector, 59
inheritance
      attributes, 62
      classes, method lookups, 6
      subclassing, 32
init.rb file, 84
initialization
      applications, 75
      environments, 311
      ObjectGraph (Og), 278
inject method, 39
inline C code, writing, 182
install.rb file, 84
installing
      plugins, 80-83
      ruby-debug, 52-56
instance variables, 19
      deprecated, 58
instance_exec method, 71
instance_methods method, 29
instantiation, classes, 7
integers, Core Extensions, 69
integration
      continuous, 321
      databases, 109
integrity, 137
      constraints, 110
interface translation, 250-255
internationalization (see i18n)
interpreting benchmarking, 163
introspection, 28-36
      Core Extensions, 70
      semantic, 2
      syntactic, 2
irb command, 54
issue tracking, 308
iv_tbl, 5

J[ Top ]
Japanese language, 238
JavaScript Object Notation (JSON), 59
JavaScript, URI encoding in UTF-8 environments, 249
JSON (JavaScript Object Notation), 59

K[ Top ]
Kerckhoffs' principle, 135
Kernel methods
      Array, 48
      binding, 27
      caller, 50
      daemonize, 69
      system, 145
kernels, Core Extensions, 69
keys, 231
      composite, 112-114
keywords
      EXPLAIN, 171
      super, 5, 7
kicker methods, 274
klass, 5
Korean language, 238

L[ Top ]
L10n (localization), 236, 290
      applications, 250
      Globalize example, 258-268
      interface/resource translation, 250-255
      locale-specific settings, 256
      model translation, 257
lambda function, 23
large object deletion, 115
large projects
      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
      issue tracking, 308
      project structure, 309
            environment initialization, 311
            externals, 310
            gems, 312
            multi-application, 313-315
            Subversion configuration, 309
      version control, 296
            branching and merging, 301-306
            centralized, 296-299
            database migrations, 306-308
            decentralized, 299-301
large/binary objects, 101-109
Last-Modified response header, 207
layered system constraint, 186
LDAP (Lightweight Directory Access Protocol), 124
left-to-right (LTR) text, 238
leveraging external programs, 182
lexical variables, continuations, 25-27
lib/ directory, 84
libraries
      Action Profiler, 153
      Action Web Service (AWS), 231
      ActiveLDAP, 124
      ActiveSupport (see ActiveSupport)
      aspect-oriented programming (AOP), 33
      attachment_fu, 107
      DataMapper, 272
      debugging, 52-56
      DrySQL, 111
      Ferret, 170
      GeoKit, 170
      JSON, 59
      metaid.rb, 17
      ObjectGraph (Og), 275-281
      ParseTree, 2
licenses, 84
Lighthouse, 309
Lighttpd servers, 318
      X-Sendfile configuration, 106
Lightweight Directory Access Protocol (LDAP), 124
Liquid, 282
Lisp, metaprogramming, 2
list command, 53
load balancing, 120-124
loading
      ActionController, 92
      files, dependencies, 57
      plugins, 79
LOB (see large/binary objects)
local variables, 19
local_request? function, 136
locale, i18n, 236
localization (see L10n)
localize method, 256
logical separation, Liquid, 283
logs
      production Log Analyzer, 153
      shipping, 123
lookup
      methods, 5-17
            delaying until runtime, 23
      variables, 19
LTR (left-to-right) text, 238

M[ Top ]
m_tbl, 5
MAC (message authentication code), 134
Magic Multi-Connections gem, 118
maintenance, running automatically, 171
management
      database management systems (DBMSs)
            MySQL, 98
            Oracle, 100
            PostgreSQL, 97
            SQL Server, 100
            SQLite, 100
      sessions, 176
      uploads, 107
map method, 38
maps
      object-relational mapping (ORM), 96
      type, 193
Markaby, 282
Marshal module, 286
master-slave replication, 121
      Slony-I, 123
mathematics, black-box analysis, 148
max method, 39
mean, 148
measurement tools, 148-155
      black-box analysis, 148-151
      code timing, 151-153
      database performance, 171
            query plans, 171-173
      Rails, 153-155
member? method, 37
memcached daemon, 119, 175
MemCacheStore, 175, 179
MemoryStore, 174
Mercurial
      branching and merging, 303
      revision numbers, 305
Mercurial Queues (MQ) extension, 161
merging, 301-306
      files, access, 298
message authentication code (MAC), 134
messages
      error, security, 136
      file control console, 69
      hash message authentication code (HMAC), 143
meta_def method, 18
meta_eval method, 18
metaclass method, 18
metaclasses
      (see singleton classes)
metaid.rb library, 17
metaprogramming
      (see programming)
metaprogramming techniques, 1-4
      bindings, 27
      continuations, 25-27
      delaying method lookup until runtime, 23
      generative programming, 24
      viewing methods at runtime, 28-36
method_missing function, 17, 23
methods, 20-23
      alias_method, 34
      application_backtrace, 66
      Array
            *, 46
            extract, 61
            in_groups_of, 61
            pack, 46
            rand, 61
            split, 61
            to_s, 61
            to_sentence, 61
            to_xml, 61
      arrays, 46
      attr_accessible, 132
      attr_accessor, 276
      attr_protected, 132
      before_save callback, 130
      chaining, 33
      Class, const_missing, 57
      class_def, 18
      clean_backtrace, 66
      clean_message, 66
      collect, 38
      delegate, 70
      DELETE, 190
      deprecate, 58
      detect, 37
      Dir, 47
      each_with_index, 39
      emulation, 217
      entries, 39
      Enumerable
            all?, 47
            grep, 47
            sort_by, 47
      etag, 221
      exceptions, 66
      expire_fragment, 180
      File
            expand_path, 144
            join, 47
            open, 47
      find, 37
      find_all, 37
      find_with_attributes, 281
      framework_backtrace, 66
      functionality, adding to existing, 32
      garbage collection, 29
      GET, 188
      grep, 38
      Hash
            asset_valid_keys, 68
            delete, 48
            diff, 67
            from_xml, 67
            new, 47
            slice, 68
            stringify_keys, 67
            to_xml, 67
      HEAD, 189
      idempotent, 189
      image_path, 319
      inject, 39
      instance_exec, 71
      instance_methods, 29
      Kernel
            Array, 48
            binding, 27
            caller, 50
            daemonize, 69
            system, 145
      kicker, 274
      localize, 256
      lookup, 5-17
            delaying until runtime, 23
      map, 38
      max, 39
      meta_def, 18
      meta_eval, 18
      metaclass, 18
      method_missing, 23
      min, 39
      Module
            const_missing, 57
            define, 25
            instance_methods, 29
            remove_method, 48
            undef_method, 48
      Object#methods, 29
      objects, 20
      partition, 38
      POST, 190
      proc, 48
      Proc#binding, 28
      PUT, 189
      reader, 25
      refresh_without_timing, 34
      reject, 38
      respond_to, 217
      runtime, viewing at, 28-36
      safe, 188, 189
      sanitize, 140
      select, 37
      session storage, 137
      silence_stream, 69
      silence_warnings, 69
      sort, 38
      sort_by, 38, 274
      String
            %, 48
            scan, 48
            unpack, 46
      suppress, 69
      Symbol#to_proc, 74
      to_a, 39
      to_hash, 275
      to_sql, 275
      UnboundMethod, 20
      zip, 38
Microsoft SQL Server, 100
migration
      ActiveRecord, 285
      databases, 306-308
MIME (Multipurpose Internet Mail Extensions), 209
      types, 218
min method, 39
MiniMagick, 107
MIT license, 84
mitigation
      cross-site request forgery (CSRF), 142
      cross-site scripting (XSS), 140
.mo files, 252
models
      ActiveRecord, 315
      copy-modify-merge, 297
      translation, 257
      user, 130
      version control, 296
            branching and merging, 301-306
            centralized, 296-299
            database migrations, 306-308
            decentralized, 299-301
Module methods
      const_missing, 57
      define_method, 25
      instance_methods, 29
      remove_method, 48
      undef_method, 48
modules, 297
      ActiveMerchant, 35
      Core Extensions, 70
      Enumerable, 37
      inclusion, method lookups, 8-12
      Marshal, 286
      ObjectSpace, 28-36
      overview of, 4
modulization, 34
Mongrel, 78, 108
monkeypatching, 31, 34
MQ (Mercurial Queues) extension, 161
mulitmaster replication, 123
multi-application projects, 313-315
multibyte character support, 242
multilingualization, 241
multiple databases, connecting, 116-118
Multipurpose Internet Mail Extensions (see MIME)
multiversion concurrency control (MVCC), 97, 98
MVCC (multiversion concurrency control), 97, 98
MyISAM, 99
MySQL, 98, 121
      8-bit Unicode Transformation Format (UTF-8), 245
      clusters, 121
      large/binary objects, 103

N[ Top ]
named branches in Mercurial, 306
names
      constants, 4
      opacity, 191
nested resource routes, 214
nginx servers, 318
normalization, Unicode, 243
notation, JSON, 59
numeric conversions, 71

O[ Top ]
Object#methods, 29
ObjectGraph (Og), 275-281
object-relational mapping (ORM), 96
objects, 231
      class, singleton classes of, 14-17
      Core Extensions, 71
      JSON, 59
      large, deleting, 115
      large/binary, 101-109
      method lookups, 5-17
      methods, 20
      promise, 274
      session, 58
      tainting, 146
ObjectSpace module, 28-36
      implementation, 276
obscurity, avoiding security through, 135
OG (ObjectGraph), 275-281
opacity, name, 191
opening classes, 31
optimization
      source control and, 161
      (see also performance)
OPTIMIZE TABLE command, 171
options
      Core Extensions, 61
      register_globals, 131
Oracle, 100
      clustering, 124
      large/binary objects, 103
ORDER BY clause, 274
ORM (object-relational mapping), 96

P[ Top ]
page caching, 177
ParseTree library, 2
partition method, 38
partitioning data, 115
passwords
      hashing, 128, 129
      recovery, 129
patches, contributing, 291
pen, 318
perf_run command, 163
performance
      ActiveRecord, 165
            1+N problem, 166
            indexing, 167-171
            SQL, 165
      architecture, scalability, 173-181
      benchmarking, 161-164
      caching, 176
            action, 177
            fragment, 178
            page, 177
            sweepers, 180
      databases, 171
            query plans, 171-173
      measurement tools, 148-155
            black-box analysis, 148-151
            code timing, 151-153
            Rails Analyzer Tools, 153-155
      profiling, 155-161
      sessions
            ActiveRecordStore, 174
            CookieStore, 176
            management, 176
            MemCacheStore, 175
            scalability, 174
pg_autovacuum daemon, 171
PGCluster, 124
Piston, 81
      Subversion externals and, 310
plain text, password recovery, 129
plugins, 79, 314
      about.yml file, 83
      account_location, 85-87
      attachments, 107
      Deadlock Retry, 93
      examples of, 85-90
      Ferret library, 170
      Gibberish, 253-254
      Globalize, 254, 257
            example of, 258-268
      HTTP Authentication, 89
      Independent Migrations, 307
      installing, 80-83
      Liquid, 283
      loading, 79
      restfully_yours, 221
      ssl-requirement, 87
      testing, 90-95
      whitelists, 141
      writing, 83-85
      (see also applications)
POST method, 190
PostgreSQL, 97
      8-bit Unicode Transformation Format (UTF-8), 247
      high availability, 123
      large/binary objects, 102
.pot files, 251
pound, 318
precomposed characters, 243
predicates, 37
privileges, DROP TABLE, 144
Proc method, 48
Proc#binding method, 28
processing
      forms, 132
      upload, 108
procs, 20-23
production branches, 302
Production Log Analyzer, 153
profiling
      Action Profiler, 153
      actions, 155-157
programming
      ActiveSupport, 57
            Core Extensions, 60-75
            dependencies, 57
            deprecation, 58
            Inflector, 59
            JSON, 59
            Whiny Nil, 60
      aspect-oriented programming (AOP), 32
programming (continued)
      bottom-up, 3
      functional, 36-41
      metaprogramming, 1-4
      reading code, 49-57
progress, upload, 108
progressive enhancement, 135
project structure, 309
      environment initialization, 311
      externals, 310
      gems, 312
      multi-application, 313-315
      Subversion configuration, 309
      (see also large projects)
promises (lazy evaluation), 274
properties, session storage methods, 137
prototyping, 287
proxy classes, delegation with, 30
PStore, 174
PUT method, 189

Q[ Top ]
query plans, 171-173

R[ Top ]
Rails
      contributing to, 289-295
      unit tests, 293
Rails Analyzer Tools, 153-155
      Action Profiler, 153
      Production Log Analyzer, 153
RailsBench tool, 161-164
rainbow attacks, 128
Rakefile, 84
      customizing, 288
random selection, 61
ranges, Core Extensions, 72
rapid prototyping, 287
RaPT, 80
reader methods, 25
reading
      call stacks, 50
      code, 49-57
      tests, 56
README file (plugins), 85
receiving email, 289
recovery, passwords, 129
redundant code, 3
Referer header, 131
register_globals option, 131
reject method, 38
replacing components
      ActiveRecord, 271-281
      alternative template engines, 282-284
replication
      factor, 121
      master-slave, 121
      multimaster, 123
reporting, 69
repository hooks, 297
Representational State Transfer (see REST)
representations, 193-195
reprofiling, 158-161
Request Tracker (RT), 308
resource-based URIs, 134
resources
      ActiveResource, 223-230
      architecture, 233
      Representational State Transfer (REST), 190-193
      routing, 211-216
      state, 195
            sessions, 198
      translation, 250-255
respond_to method, 217
response status codes, Hypertext Transfer Protocol (HTTP), 222
REST (Representational State Transfer)
      benefits of, 205-209
      overview of, 185-187
      representations, 193-195
      resources, 190-193
      RESTful Rails, 209-231
      statelessness, 195-205
      verbs, 187-190
RESTful Rails URI conventions, 199
restfully_yours plugin, 221
results, interpreting benchmarking, 163
revision
      code, downloading, 297
      Mercurial numbers, 305
right-to-left (RTL) text, 238
RMagick, 107, 182
robustness to change, 208
routing
      code, 43
      resources, 211-216
      RESTful, 210
RT (Request Tracker), 308
RTL (right-to-left) text, 238
Ruby-DBI (Ruby database-independent adapter), 100
ruby-debug, 52-56
RubyGems, 312, 314
      Magic Multi-Connections, 118
RubyInline, 182
rules, 114
      method lookups, 5
running
      benchmarks, 163
      maintenance automatically, 171
runtime
      Apache Portable Runtime (APR), 299
      feature change, 41
      methods
            delaying lookup until, 23
            viewing at, 28-36

S[ Top ]
safe methods, 188, 189
salting passwords, 128
SAN (storage area network), 124
sanitize method, 140
scaffolding, 291
scalability
      architecture, 173-181
      Representational State Transfer (REST), 206
      shared-nothing, 316-317
Scalable Coherent Interconnect (SCI), 121
scanning profiles, 158-161
schemas
      ActiveRecord migration, 285
      definition methods, 129
SCI (Scalable Coherent Interconnect), 121
script/plugin tool, 80-83
searching
      code, 49
      global searches, 56
Seaside, 26
security
      application design, 127-137
      architecture
            canonicalization, 143
            cross-site request forgery (CSRF), 141-143
            cross-site scripting (XSS), 139-141
            sessions, 137-139
            web issues, 137-144
      authentication, 127-130
      clients, 130-135
      environments, 145
      error messages, 136
      Liquid, 283
      obscurity, 135
      secure fallback, 135
      SQL injection, 144
      whitelists, 137
select method, 37
selection
      of representations, 193
      tools, 182
semantic introspection, 2
sendfile function, 104
sending data with X-Sendfile, 105
separation of concerns, 4
Serializable isolation level, 97
servers
      8-bit Unicode Transformation Format (UTF-8), 248
      Amazon S3 (Simple Storage Services) case study, 234
      Apache, 318
      applications, 319
      black-box analysis, 148
      front end web, 317-319
      Lighttpd, 318
      nginx, 318
      pen, 318
      pound, 318
services
      Action Web Service (AWS), 231
      ActiveResource, 223-230
      Amazon S3 (Simple Storage Service) case study, 231-235
serving static files, X-Sendfile, 107
sessions
      cookies, 138
            cross-site request forgery (CSRF), 141
      hijacking, 138
      management, 176
      objects, 58
      scalability, 174
      security, 137-139
      state, 195
            resources, 198
      sticky, 138, 197
      storage
            ActiveRecordStore, 174
            CookieStore, 134, 176
            fragments, 179
            MemCacheStore, 175
            methods, 137
Settings constructor, 31
S-expressions, 2
shared-nothing architecture, 197
shared-nothing scalability, 316-317
shells, security, 145
silence_stream method, 69
silence_warnings method, 69
simplicity
      Liquid, 282
      of Representational State Transfer (REST), 206
singleton classes, 12-14
      of class objects, 14-17
      resource routes, 215
Slony-I, 123
Smalltalk web application framework, 26
sort method, 38
sort_by method, 38, 274
source control and optimization, 161
spatial indexes, 170
SQL (Structured Query Language)
      ActiveRecord performance, 165
      injection, 144
      performance, 171
            query plans, 171-173
      (see also databases)
SQL Server, 100
SQLite, 100
ssl_requirement plugin, 87
stacks
      continuations, 25-27
      reading, 50
standalone data stores, ActiveRecord, 286
standard deviation, 149
starting ruby-debug, 52-56
state
      continuations, 25-27
      Hypertext Transfer Protocol (HTTP), 196
      resources, 195
      session, 195, 198
stateless constraint, 186
statelessness, 195-205
statements, bindings, 27
static files
      asset hosts for, 319
      X-Sendfile, 107
statistical calculations, 65
statistics, 148
      indexes, updating, 171
sticky sessions, 138, 197
storage
      8-bit Unicode Transformation Format (UTF-8), 245-248
      databases, 102
      filesystems, 103
      sessions
            CookieStore, 134
            methods, 137
storage area network (SAN), 124
stored procedures, 114
stores
      ActiveRecord standalone data, 286
      session fragments, 179
String methods
      %, 48
      scan, 48
      unpack, 46
strings, Core Extensions, 72
structure, project, 309
      environment initialization, 311
      externals, 310
      gems, 312
      multi-application, 313-315
      Subversion configuration, 309
Structured Query Language (see SQL)
subclassing, 32
Subversion, 253, 298
      branching and merging, 302
      configuration, 309
Subverted Migrations, 307
super keyword, 5, 7
suppress method, 69
svn import command, 309
sweepers, cache, 180
Symbol#to_proc method, 74
syntactic introspection, 2
SyslogLogger, 153

T[ Top ]
tables, rainbow, 128
tainting, 146
TamperedWithCookie exception, 134, 138
TCP (Transmission Control Protocol), sequence-number prediction attack, 138
templates
      alternative engines, 282-284
      New Product, 226
test fixtures, 94, 315
test/ directory, 85
Test-Driven Development (test-first) style, 56
testing
      components, 293
      plugins, 90-95
      reading tests, 56
text
      bidirectional, 238
      copy-modify-merge model, 297
      full-text indexing, 169
      gettext, 250-253
      password recovery, 129
text editors, 50
tickets, filing, 292
time
      calculations, 64
      conversions, 64
      formats, 63
Timestamped Migrations, 308
TimeZone, 75
timing, code, 151-153
to_a method, 39
to_hash method, 275
to_sql method, 275
tokens, hash message authentication code (HMAC), 143
tools
      continuous integration, 321
      measurement, 148-155
            black-box analysis, 148-151
            code timing, 151-153
            Rail Analyzer Tools, 153-155
      RailsBench, 161-164
      ruby-debug, 52-56
      RubyInline, 182
      script/plugin, 80-83
      selecting, 182
Trac, 309
      issue-tracking, 292
tracking issues, 308
TRADITIONAL command, 99
traffic, black-box analysis, 148
transformers, 38
translation
      adding, 255
      files, creating, 253
      GNU gettext, 250-253
      interface/resource, 250-255
      models, 257
transparency, requirement of HTTP caching, 206
transparent subclasses, 33
triangles, REST, 187
triggers, 114
troubleshooting
      ASCII, 238
      components, 293
      debugging, 52-56
      plugins, 90-95
      security, 137-144
            canonicalization, 143
            cross-site request forgery (CSRF), 141-143
            cross-site scripting (XSS), 139-141
            sessions, 137-139
trunks, cloning, 303
type maps, 193
types
      content, 193-195
            RESTful Rails, 217-219
      of variables, 19

U[ Top ]
UnboundMethod, 20
Unicode, 238-249
uniform interface constraint, 186
uniformity, Representational State Transfer (REST), 209
uninstall.rb file, 85
unit tests, 293
update commands, 297
updating index statistics, 171
uploading
      management, 107
      processing, 108
      progress, 108
URIs (Uniform Resource Identifiers)
      extensions, 193
      resource-based, 134
      RESTful Rails conventions, 199
User model, 130
User-Agent header, 131
UTF-8 (8-bit Unicode Transformation Format), 239
      conversion, 248-249
      input, filtering, 244
      servers, 248
      storage, 245-248

V[ Top ]
VACUUM ANALYZE command, 171
validation, client-side, 133
values, functional programming, 36-41
variables
      classes, 19
      continuations, 25-27
      global, 19
      instance, deprecated, 58
      instances, 19
      local, 19
      lookup, 19
verbs, 187-190
version control, 296
      branching and merging, 301-306
      centralized, 296-299
      database migrations, 306-308
      decentralized, 299-301
versions
      Concurrent Versions System (CVS), 297
      decentralized control, 82
      Subversion, 298
Vietnamese language, 238
VIP (Virtual IP address), 122
virtual classes, 13
Virtual IP address (VIP), 122
Vlad the Deployer, 321
VRRP (Virtual Router Redundancy Protocol), 316, 318

W[ Top ]
warm standby, 123
Web Accelerator, 188
web applications, security design, 127-137
web servers, front end, 317-319
web services
      Action Web Service (AWS), 231
      Active Resource, 223-230
      Amazon S3 (Simple Storage Service) case study, 231-235
Western European languages, 238
Whiny Nil, 60
whitelists, 137
      plugins, 141
working copy, 297
writing
      code on-the-fly, 24
      inline C code, 182
      patches, 291
      plugins, 83-85
WWW-Authenticate header, 89

X[ Top ]
X-Sendfile
      configuration, 106
      sending data with, 105
XSS (cross-site scripting), 139-141

Z[ Top ]
ZenTest suite of tools, 322
zip method, 38




Return to Advanced Rails