The Rails way: [covers Rails 2.0]
Gespeichert in:
1. Verfasser: | |
---|---|
Format: | Buch |
Sprache: | English |
Veröffentlicht: |
Upper Saddle River, NJ [u.a.]
Addison Wesley
2008
|
Ausgabe: | 2. print. |
Schriftenreihe: | Addison-Wesley professional ruby series
|
Schlagworte: | |
Online-Zugang: | Inhaltsverzeichnis |
Beschreibung: | Includes index |
Beschreibung: | LIX, 851 S. Ill. |
ISBN: | 0321445619 9780321445612 |
Internformat
MARC
LEADER | 00000nam a2200000 c 4500 | ||
---|---|---|---|
001 | BV023244719 | ||
003 | DE-604 | ||
005 | 20080514 | ||
007 | t | ||
008 | 080408s2008 a||| |||| 00||| eng d | ||
010 | |a 2007039880 | ||
020 | |a 0321445619 |c pbk. : alk. paper |9 0-321-44561-9 | ||
020 | |a 9780321445612 |9 978-0-321-44561-2 | ||
024 | 3 | |a 9780321445612 | |
035 | |a (OCoLC)263704961 | ||
035 | |a (DE-599)BSZ275502686 | ||
040 | |a DE-604 |b ger | ||
041 | 0 | |a eng | |
049 | |a DE-91G | ||
050 | 0 | |a QA76.64 | |
082 | 0 | |a 005.117 | |
084 | |a ST 253 |0 (DE-625)143628: |2 rvk | ||
084 | |a DAT 368f |2 stub | ||
084 | |a DAT 677f |2 stub | ||
084 | |a DAT 315f |2 stub | ||
100 | 1 | |a Fernandez, Obie |e Verfasser |0 (DE-588)134112997 |4 aut | |
245 | 1 | 0 | |a The Rails way |b [covers Rails 2.0] |c Obie Fernandez |
250 | |a 2. print. | ||
264 | 1 | |a Upper Saddle River, NJ [u.a.] |b Addison Wesley |c 2008 | |
300 | |a LIX, 851 S. |b Ill. | ||
336 | |b txt |2 rdacontent | ||
337 | |b n |2 rdamedia | ||
338 | |b nc |2 rdacarrier | ||
490 | 0 | |a Addison-Wesley professional ruby series | |
500 | |a Includes index | ||
630 | 0 | 4 | |a Ruby on rails (Electronic resource) |
650 | 4 | |a Object-oriented programming (Computer science) | |
650 | 4 | |a Ruby (Computer program language) | |
650 | 4 | |a Web site development | |
650 | 4 | |a Application softare / Development | |
650 | 0 | 7 | |a Ruby on Rails |0 (DE-588)7516633-1 |2 gnd |9 rswk-swf |
689 | 0 | 0 | |a Ruby on Rails |0 (DE-588)7516633-1 |D s |
689 | 0 | |5 DE-604 | |
856 | 4 | 2 | |m HBZ Datenaustausch |q application/pdf |u http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=016430200&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA |3 Inhaltsverzeichnis |
999 | |a oai:aleph.bib-bvb.de:BVB01-016430200 |
Datensatz im Suchindex
_version_ | 1804137544442445824 |
---|---|
adam_text | Titel: The Rails way
Autor: Fernandez, Obie
Jahr: 2008
xii Contents
Contents
Chapter 1 Rails Environments and Configuration 1
Startup 2
Default Environment Settings 2
Mode Override 2
Rails Gem Version 2
Bootstrapping 3
RubyGems 5
Initializer 6
Default Load Paths 6
Rails, Modules, and Auto-Loading Code 7
Builtin Rails Info 8
Configuration 9
Skipping Frameworks 9
Additional Load Paths 10
Log-Level Override 10
ActiveRecord Session Store 10
Schema Dumper 11
Observers 11
Time Zones 11
Additional Configuration 13
Development Mode 14
Automatic Class Reloading 15
The Rails Class Loader 15
Test Mode 17
Production Mode 17
Logging 18
Rails Log Files 20
Contents xiii
Log File Analysis 22
Sysbg 24
Conclusion 25
References 25
Chapter 2 Working with Controllers 27
The Dispatcher: Where It All Begins 28
Request Handling 28
Getting Intimate with the Dispatcher 29
Render unto View... 31
When in Doubt, Render 32
Explicit Rendering 33
Rendering Another Actions Template 33
Rendering a Different Template Altogether 34
Rendering a Partial Template 35
Rendering Inline Template Code 35
Rendering Text 35
Rendering Other Types of Structured Data 36
:json 36
:xml 36
Rendering Nothing 36
Rendering Options 37
:content_type 37
:layout 37
¡status 37
Redirecting 39
Controller/View Communication 42
Filters 43
Filter Inheritance 44
Filter Types 46
Filter Classes 46
Inline Filter Method 47
Filter Chain Ordering 47
Around Filters 48
Filter Chain Skipping 49
xiv Contents
Filter Conditions 50
Filter Chain Halting 50
Streaming 51
send_data(data, options = {}) 51
Options for send_data 51
Usage Examples 52
send_file(path, options = {}) 52
Options for send_file 53
Usage Examples 55
Letting the Web Server Send Files 55
Conclusion 56
References 56
Chapter 3 Routing 57
The Two Purposes of Routing 58
Bound Parameters 60
Wildcard Components ( Receptors ) 61
Static Strings 62
The routes.rb File 63
The Default Route 65
Spotlight on the :id Field 66
Default Route Generation 67
Modifying the Default Route 68
The Ante-Default Route and respond_to 69
respondjto and the HTTP-Accept Header 70
The Empty Route 71
Writing Custom Routes 72
Using Static Strings 72
Using Your Own Receptors 73
A Note on Route Order 75
Using Regular Expressions in Routes 76
Default Parameters and the url_for Method 76
What Happened to :id? 77
Using Literal URLs 79
Route Globbing 79
Globbing Key-Value Pairs 80
Named Routes 81
Contents xv
Creating a Named Route 81
The Question of Using name_path Versus name_url 82
Considerations 83
What to Name Your Routes 83
Argument Sugar 84
A Little More Sugar with Your Sugar? 85
The Special Scope Method with_options 86
Conclusion 88
References 88
Chapter 4 REST, Resources, and Rails 89
REST in a Rather Small Nutshell 89
REST in Rails 91
Routing and CRUD 92
Resources and Representations 93
REST Resources and Rails 93
From Named Routes to REST Support 94
Reenter the HTTP Verb 96
The Standard RESTful Controller Actions 96
The PUT and DELETE Cheat 98
Singular and Plural RESTful Routes 98
The Special Pairs: new/create and edit/update 99
Singular Resource Routes 100
Nested Resources 101
Setting :path_prefix Explicitly 103
Setting :name_prefix Explicitly 103
Specifying RESTfiil Controllers Explicitly 105
All Together Now 105
Considerations 107
Deep Nesting? 108
RESTful Route Customizations 110
Extra Member Routes 110
Extra Collection Routes 111
Considerations 112
Controller-Only Resources 113
Different Representations of Resources 115
Contenu
The rtspond_to ¡Method ¡16
Formatted Named Routa ¡17
The RESTful Rails Action Set IV,
Index 118
Show ¡21
Destroy 121
New and Create ¡23
Edit and Update 124
Conclusion 125
Reference 126
Chapter 5 Reflecting on Rails Routing 127
Examining Routes in the Application Console 127
Dumping Routes ¡28
Anatomy of a Route Object 129
Recognition and Generation in the Console 132
Named Routa in the Console ¡34
Testing Routes 135
The Routing Navigator Plugin 136
Conclusion 137
References 137
Chapter 6 Working with ActiveRecord 139
The Basics 140
Migrations 142
Creating Migrations 143
Naming Migrations 144
Migration Pitfalls 145
Migration API 146
create_table(name, options) 147
Defining Columns 149
Column Type Mappings 150
Column Options 151
Decimal Precision 152
Column Type Gotchas 152
Custom Data Types 154
Magic Timestamp Columns 154
Macro-Style Methods 155
Relationship Declarations 155
Contents xvii
Convention over Configuration 156
Pluralization 157
Should I Report INFLECTOR Bugs to the Core Team? 158
Setting Names Manually 158
Legacy Naming Schemes 159
Defining Attributes 160
Default Attribute Values 160
Serialized Attributes 162
CRUD: Creating, Reading, Updating, Deleting 163
Creating New ActiveRecord Instances 163
Reading ActivcRecord Objects 164
find 164
Reading and Writing Attributes 166
Hash Notation 167
The attributes Method 168
Accessing and Manipulating Attributes Beßre They Are Typecast 168
Reloading 169
Dynamic Attribute-Based Finders 169
Custom SQL Queries 171
The Query Cache 172
Logging 173
Default Query Caching in Controllers 173
Limitations 174
Updating 174
Updating by Condition 176
Updating a Particular Instance 176
Updating Specific Attributes 177
Convenience Updaten 177
Controlling Access to Attributes 178
Deleting and Destroying 178
Database Locking 179
Optimistic Locking 180
Handling StaleObjectError 181
Pessimistic Locking 182
Considerations 183
Advanced Finding 183
Conditions 183
Boolean Conditions 185
sviii Conten»
Random Ordering 186
Limit and Offset ¡86
Select Option 187
From Option 188
Group By Option ¡88
Locking Option ¡89
Joining and Including Associations ¡89
Read Only 189
Connections to Multiple Databases in Different Models 189
Using the Database Connection Directly 191
The DatabaseStatements Module ¡9Í
begin_db_transaction() 191
commit_db_transaction() 192
delete(sql_statement) 192
execute(sql_statement) 192
insert(sql_statement) 192
reset_sequence!(table, column, sequence = nil) 192
rollback_db_transactionO 192
select_all(sql_statement) 192
select_one(sql_statement) 193
select_value(sql_statement) 193
select_values(sqi_statement) 193
updateCsqLstatement) 193
Other Connection Methods 194
active? 194
adapter_name 195
disconnect! and reconnect! 195
raw_connection 195
supports_count_distinct? 195
supports_migrations? 195
tables 195
verify!(timeout) 196
Other Configuration Options 196
Conclusion 197
References 198
Contents xix
Chapter 7 ActiveRecord Associations 199
The Association Hierarchy 199
One-to-Many Relationships 201
Adding Associated Objects to a Collection 203
AssociationCotiection Methods 204
«( records) and crcateiattributes = |}) 204
clear 205
deleteCrecords) and delcte_all 205
destroy_all 206
length 206
replace(other_array) 206
size 206
sum(column, options) 206
uniq 207
The belongs_to Association 207
Reloading the Association 208
Building and Creating Related Objects via the Association 208
belongs_to Options 209
:class_name 209
¡conditions 210
:foreign_key 213
:counter_cache 213
:indude 214
¡polymorphic - true 214
The has_many Association 215
hasjmany Options 216
:after_add 216
:after_remove 216
:as 216
:before_add 217
:before_remove 217
:dass_name 218
¡conditions 218
: coun ter_sql 218
:delete_sql 218
xx Contents
¡dependent = :delete_all 219
¡dependent = :destroy_all 219
¡dependent = ¡nullify 219
:exclusively_dependent 219
¡extend = ExtensionModule 219
:finder_sql 219
¡foreignjcey 219
¡group 220
¡include 220
:insert_sql 223
¡limit 223
¡offset 223
¡order 223
¡select 223
¡source and ¡source_type 223
:table_name 223
¡through 224
¡uniq = true 224
Proxy Methods 224
build(attributes = {}) 224
count(*args) 225
find(*args) 225
Many-to-Many Relationships 225
has_and_belongþ_to_many 225
Self-Referential Relationship 226
Bidirectional Relationships 227
Custom SQL Options 229
Extra Columns on has_and_belongs_to_many Join Tables 232
Real Join Models and habtm 232
has_many ¡through 233
Join Models 233
Usage Considerations and Examples 235
Aggregating Associations 236
Join Models and Validations 237
has_many ¡through Options 238
¡source 238
Contents xxi
:source_type 238
:uniq 240
One-to-One Relationships 241
has_one 241
has_one Options 244
:as 244
:class_name 244
xonditions 245
¡dependent 245
:foreign_key 245
.•include 245
¡order 246
Unsaved Objects and Associations 246
One-to-One Associations 246
Collections 247
Association Extensions 247
The AssociationProxy Class 249
reload and reset 249
proxy_owner, proxy_reflection, and proxy_target 249
Conclusion 250
References 251
Chapter 8 ActiveRecord Validations 253
Finding Errors 253
The Simple Declarative Validations 254
validates_acceptance_of 254
Error Message 255
The accept Option 255
validates_associated 255
validates_confirmation_of 256
validates_each 256
validates_inclusion_of and validates_exclusion_of 257
validates_existence_of 257
validates_format_of 258
validates_length_of 259
xxii Contents
Constraint Options 260
Error Message Options 260
validates_numericality_of 260
validates_presence_of 261
Validating the Presence of Associated Objects 261
validates_uniqueness_of 261
Enforcing Uniqueness of Join Models 262
Recordlnvalid 263
Common Validation Options 263
:allow_nil 263
:if 263
¦.message 263
:on 264
Conditional Validation 264
Usage and Considerations 265
Working with the Errors Object 266
Manipulating the Errors Collection 267
add_to_base(msg) 267
add(attribute, msg) 267
clear 267
Checking for Errors 267
invalid?(attribute) 267
on(attribute) 267
Custom Validation 268
Skipping Validations 269
Conclusion 270
Reference 270
Chapter 9 Advanced ActiveRecord 271
Callbacks 271
Callback Registration 272
One-Liners 273
Protected or Private 273
Matched before/after Callbacks 274
List of Callbacks 274
Halting Execution 274
Contents xxiii
Callback Usages 275
Cleaning Up Attribute Formatting with before_validate_on_create 275
Geocoding with before_save 275
Paranoia with before_destroy 277
Cleaning Up Associated Files with after_destroy 277
Special Callbacks: afier_initialize and afier_find 278
Callback Classes 279
Multiple Callback Methods in One Class 280
Testability 282
Observers 282
Naming Conventions 283
Registration of Observers 283
Timing 284
Single-Table Inheritance (STI) 284
Mapping Inheritance to the Database 286
STI Considerations 288
STI and Associations 288
Abstract Base Model Classes 291
Polymorphic has_many Relationships 292
In the Case of Models with Comments 293
The Interface 293
The Database Columns 294
Has_many ¡through and Polymorphics 295
Considerations about has_many 296
Modules for Reusing Common Behavior 296
A Review of Class Scope and Contexts 299
The included Callback 300
Modifying ActiveRecord Classes at Runtime 301
Considerations 303
Ruby and Domain-Specific Languages 303
Conclusion 305
References 305
Chapter 10 ActionView 307
ERb Basics 308
ERb Practice 308
Tightening Up ERb Output 310
Contents
Commenting Out ERb Delimiters 310
Conditional Output 311
RHTML? RXMU RJS? 311
Layouts and Templates 312
Yielding Content 313
Template Variables 315
Instance Variables 315
assigns 316
base_path 316
controller 316
flash 317
headers 318
logger 318
params 319
request and response 319
session 319
Protecting the Integrity of Your View from User-Submitted Content 319
Partíais 320
Simple Use Cases 321
Reuse ofPartials 322
Shared Partíais 323
Passing Variables to Partíais 324
The local_assigns Hash 325
Render Collections 325
The partial_counter Variable 326
Sharing Collection Partíais 326
Logging 327
Caching 327
Caching in Development Mode? 328
Page Caching 328
Action Caching 328
Design Considerations 329
Fragment Caching 330
The cache Method 330
Named Fragments 331
Global Fragments 332
Contents
Avoiding Extra Database Activity 333
Expiration of Cached Content 333
Expiring Pages and Actions 333
Expiring Fragments 334
Using regular expressions in expiration calls 334
Automatic Cache Expiry with Sweepers 335
Cache Logging 337
Action Cache Plugin 337
Cache Storage 338
Configuration Example 339
Limitations of File-Based Storage 339
Manual Sweeping with rake 339
Conclusion 340
References 340
Chapter 11 All About Helpers 341
ActiveRecordHelper 342
Reporting Validation Errors 342
error_message_on(object, method, prepend_text = , append_text = , css_class ¦
formError ) 342
error_messages_for(*params) 343
Automatic Form Creation 344
form(name, options) 344
input(name, method, options) 346
Customizing the Way Validation Errors Are Highlighted 346
AssetTagHelper 348
Head Helpers 348
auto_discovery_link_tag(tvpe = :rss, url_options = {}, tag_options = {}) 348
image_path(source) 350
image_tag(source, options = {}) 350
javascript_include_tag(*sources) 351
javascript_path(source) 352
stylesheet_link_tag(*sources) 352
stylesheet_path(source) 352
For Plugins Only, Add Default JavaScript Includes 352
Contents
BenchmarkHelper 353
benchmarkímessage = Benchmarking , level = :info) 353
CacheHelper 353
CaptureHelper 354
capture( block) 354
content_for(name, block) 354
DateHelper 355
The Date and Time Selection Helpers 355
date_select(object_name, method, options = {}) 355
datetime_select(object_name, method, options = {}) 356
time_select(object_name, method, options = {}) 356
The Individual Date and Time Select Helpers 356
select_date(date = Date.today, options = {}) 357
select.datetimeidatetime = Time.now, options = {}) 357
selec^dayidate, options = {}) 357
select_hour(datetime, options = {}) 357
select_minute(datetime, options = {}) 357
select_month(date, options = {}) 358
select_second(datetime, options = {}) 358
select_time(datetime, options = {}) 358
select_year(date, options = {}) 359
Common Options for Date Selection Helpers 359
distance_in_time Methods with Complex Descriptive Names 359
distance_of_time_in_words(from_time, to_time = 0, include_seconds = false) 360
distance_of_time_in_words_to_now(from_time, indude_seconds = false) 361
DebugHelper 361
FormHelper 362
Creating Forms for ActiveRecord Models 362
Variables Are Optional 363
Rails-Generated Form Conventions 363
Displaying Existing Values 364
Updating Multiple Objects at Once 364
Square Brackets with New Records? 365
Indexed Input Fields 366
Faux Accessors 369
How Form Helpers Get Their Values 370
FormOptionsHelper 371
Contents xxvü
Select Helpers 371
coUection_select(object, attribute, collection, value_method, text_method, options = {},
html_options = {}) 372
country_select(object, attribute, priority_countries = nil, options = {}, html_options = {})
372
selectCobject, attribute, choices, options = {}, html_options = {}) 372
time_zone_select(object, method, priority_zones = nil, options = {}, html_options = {}) 373
Option Helpers 373
country_options_for_select(selected = nil, priority_countries = nil) 373
option_groups_from_collection_for_select(collection, group_method, group_label_method,
option_key_method, option_value_method, selected_key = nil) 373
options_for_select(container, selected = nil) 375
options_from_collection_fbr_select(collection, value_method, text_method, selected=nil)
377
time_zone_options_for_select(selected = nil, priority_ zones = nil, model = TimeZone) 377
FormTagHelper 378
check_box_tag(name, value = 1 , checked = false, options = {}) 378
end_form_tag 378
file_field_tag(name, options = {}) 378
form_tag(url_fbr_options = {}, options = {}, *parameters_for_url, block) 379
hidden_field_tag(name, value = nil, options = {}) 380
image_submit_tag(source, options = {)) 380
password_field_tag(name = password , value = nil, options = {}) 380
radio_button_tag(name, value, checked = false, options = {}) 380
select_tag(name, option_tags = nil, options = {}) 380
start_form_tag 380
submit_tag(value = Save changes , options = {}) 381
text_area_tag(name, content = nil, options = {}) 381
text_field_tag(name, value = nil, options = {}) 381
JavaScriptHelper 381
button_to_function(name, function, html_options={}, block) 381
defincjavascriptjfunctionsO 382
escape.javascriptQavascript) 382
javascript_tag(content, html_options={}) 382
link_to_function(name, function, html_options={}, block) 382
NumberHelper 383
human_size(size, precision=l) 383
number_to_currency(number, options = {}) 383
xxviii Contents
number_to_human_size(size, precision=l) 384
number_to_percentage(number, options = {}) 384
number_to_phone(number, options = {}) 385
number_with_delimiter(number, delimiter= , , separator= . ) 385
number_with_precision(number, precision=3) 385
PaginationHelper 386
tuill_paginate 386
paginator 387
Paginating Find 388
RecordldentificationHelper 388
dom_class(record_or_class, prefix = nil) 389
dom_id(record, prefix = nil) 389
partial_path(record_or_class) 389
RecordTagHelper 390
content_tag_for(tag_name, record, *args, block) 390
div_for(record, *args, block) 391
TagHelper 391
cdata_section(content) 391
content_tag(name, content = nil, options = nil, Síblock) 391
escape_once(html) 392
tag(name, options = nil, open = false) 392
TextHelper 393
auto_link(text, link = :all, href_options = {}, block) 393
concatCstring, binding) 393
cycle(first_value, Values) 394
excerpt(text, phrase, radius = 100, excerpt_string = ... ) 395
highlight(text, phrases, highlighter = strong class= highlight l /strong ) 395
markdown(text) 396
pluralize(count, singular, plural = nil) 396
reset_cyde(name = default ) 397
sanitize(html) 397
simple_format(text) 398
strip_links(text) 398
strip_tags(html) 398
textilize(text) 399
textilize_without_paragraph(text) 399
Contents xxix
truncate (text, length = 30, truncate_string = ... ) 399
word_wrap(text, line_width = 80) 400
UrlHelper 400
button_to(name, options = {}, html_options = {}) 400
current_page?(options) 401
link_to(name, options = {}, html_options = nil) 401
link_to_if(condition, name, options = {}, html_options = {}, block) 403
link_to_unless(condition, name, options = {}, html_options = {}, block) 403
link_to_unless_current(name, options = {}, html_options = {}, block) 403
mail_to(email_address, name = nil, html_options = {}) 404
url_for(options = {}) 405
Relying on Named Routes 406
Writing Your Own Helpers 407
Small Optimizations: The Title Helper 407
Encapsulating View Logic: The photo_for Helper 408
Smart View: The breadcrumbs Helper 409
Wrapping and Generalizing Partíais 410
A tiles Helper 410
Explanation of the Tiles Partial Code 411
Calling the Tiles Partial Code 412
Write the Helper Method 413
Generalizing Partíais 414
Lambda: the Ultimate 414
The New Tiled Helper Method 415
Conclusion 417
References 417
Chapter 12 Ajax on Rails 419
Prototype 420
FireBug 421
The Prototype API 421
Top-Level Functions 422
$(id[, id2...]) 422
$$(expr[, expr2...]) 423
$A(var) 423
$F(id) 423
Contents
$H(obj) 423
$R(start, end, exclusive) 423
Try.theseCfuncl, func2[, fUnc3...] 423
Class 424
Extensions to JavaScript s Object Class 425
Object.cloneCobject) 425
Object.extendCdestination, source) 425
Object.keys(obj) and Object.values(obj) 425
Object.inspectCparam) 426
Extensions to JavaScripts Array Class 426
array.clearO 426
array.compactO 426
array.firstO and array.last() 426
array.flattenO 427
array.indexOf(object) 427
array.inspectO 427
array.reverse(inline) 427
array.shiftO 428
array.without(obj 1 [, obj2, ...]) 428
Extensions to the document Object 428
Extensions to the Event Class 428
Event.elementO 429
Event.findElement(event, tagName) 429
Event.isLeftClickCevent) 429
Event.observe(element, name, observer, useCapture) and Event.stopObserving(element,
name, observer, useCapture) 429
Event.pointerX(event) and Event.pointerY(event) 430
Event.stop(event) 430
Extensions to JavaScripts Function Class 430
function.bind(obj) 430
function.bindAsEventListener(obj) 431
Extensions to JavaScript s Number Class 432
number.toColorPartO 432
number.succO 433
number.timesO 433
Extensions to JavaScript s String class 433
string.camelizeO 433
Contents
string.dasherizeO 434
string.escapeHTMLO and string.unescapeHTML() 434
string.evalScriptsO and string.extractScriptsO 434
string.gsub(pattern, replacement) and string.sub(pattern, replacement, count) 434
string.scan(pattern, iterator) 434
string.stripO 435
string.stripScriptsO and string.stripTags() 435
string.parseQueryO and string.toQueryParams() 435
string.toArrayO 435
string.truncate(length, truncationString) 435
string. underscoreO 436
The Ajax Object 436
Ajax.activeRequestCount 436
Ajax.getTransportO 436
Ajax. Responden 437
Ajax.Responders.registerCresponder) 437
Ajax.Responders.unregister(responder) 437
Enumerable 437
enumerable.eachíiterator) 438
enumerable.all(iterator) 438
enumerable.any(iterator) 438
enumerable.collectCiterator) and enumerable.map(iterator) 439
enumerable.detect(iterator) and enumerable.find(iterator) 439
enumerable.eachSliceinumberf, iterator]) 439
enumerable.findAll(iterator) and enumerable.selectiiterator) 439
enumerable.grep(pattern[, iterator]) 440
enumerable.include(obj) and enumerable.memberiobj) 440
enumerable.inGroupsOf(num[, filier]) 440
enumerable.injectCaccumulator, iterator) 441
enumerable.invokeifunctionNamef, argl, arg2...]) 441
enumerable.maxífiterator]) and enumerable.minífiterator]) 441
enumerable.partitionCfiterator]) 441
enumerable.pluckipropertyName) 442
enumerable.rejectiiterator) 442
enumerable.sortBy(iterator) 442
enumerable.toArrayO and enumerable.entriesQ 442
Contenu
enumerable.zip(enuml. enum2[. cnum3...][. iterator!) 4*13
Hash 44J
rush.keyiO and ha, h.va!uîs() 443
ru.ih.merge(another) 443
rush.toQueryStringO 444
Objfctfünjrr 444
Tht Prvtotypt Ohjtct 445
The Prototype Helper Module 44 S
link_tojrtmott 445
rrmote_form_^üT 449
ptripdicýilly_cali_rrmott 451
obsent_field 45 t
observe_firm 453
RJS—Writing Javascript in Ruhr 453
RJS TempLitet 455
(javascript) 456
[](,d) 457
alm(mtssagt) 457
callifunction, ^arguments, óilm-k} 45~
delayisetonds * I) f... } 458
draggahle(id, options = {}) 458
drop_receivingfid, options = {}) 458
hideCids) 458
insert_html(position, id, *eptions_fir_rrndrr) 458
¡iteral(code) 459
rrdirtct_to(location) 459
removeCids) 459
replacefid, *options_for_rrnder) 460
rrplace_btml(id, *options_fir_rendtr) 460
selfctfpattern) 460
show(*ids) 460
sortable(id options = {}) 460
toggüCids) 461
vùuaLeffiafname, id = nil, options = {}) 461
JSON 461
Drag and Drop 463
Contents xxxiii
Sonable 465
Autocompletcr 466
In-Placc Editors 467
Conclusion 467
References 468
Chapter 13 Session Management 469
What to Store in the Session 470
The Current User 470
Session Use Guidelines 470
Session Options 471
Disabling Sessions fir Robots 472
Selectively Enabling Sessions 473
Secure Sessions 473
Storage Mechanisms 473
ActiveRecord SessionStore 473
PStore (File-Based) 474
DRb Session Storage 475
memcache Session Storage 475
The Controversial CookieStore 476
Timing Out and Session Life Cycle 478
Session Timeout Plugin for Rails 478
Tracking Active Sessions 479
Enhanced Session Security 480
Cleaning Up Old Sessions 481
Cookies 481
Reading and Writing Cookies 482
Conclusion 483
References 483
Chapter 14 Login and Authentication 485
Acts as Authenticated 486
Installation and Setup 486
The User Model 487
Non-Database Attributes 490
Validations 492
The before_save Callback 493
The authenticate Method 494
The remember_token 495
«xiv Onu«»
The Account (,i I.*nW« f ;f
Loçtifrom Cookie -i .W
The Curren! User 499
Losging In During Testing ^01
Conclusion 502
References 502
Chapter 15 XML and ÂctiveResource 503
The to_xm! Method 503
Customizing to_xm! Output Wi
Associations and to_xml 50 ~
Advanced to_xm¡ 503
Dynamic Runtime Atinbutrt 509
Overriding to_xml 510
Learning from Array s to_xrn! Mtthid $¡0
The XML Builder 513
Parsing XML 515
TurningX¡ fL into Hashes 5/5
KmlSimple 516
Typecasting 518
ÂctiveResource 519
Find 519
Create 522
Update 524
Delete 524
Headers 526
Customizing 527
Hash Forms 528
Conclusion 529
Chapter 16 ActionMailer 531
Setup 531
Mailer Models 532
Preparing Outbound Email Messages 533
attachment 534
bec 534
bodv 534
Contents xxxv
cc 534
charset 534
content_type 534
from 534
headers 534
impl¡cit_parts_order 535
mailer_name 535
mime_version 535
part 535
recipients 535
sent_on 536
subject 536
template 536
HTML Email Messages 536
Multipart Messages 537
Part Options 538
Implicit Multipart Messages 539
File Attachments 539
Actually Sending an Email 540
Receiving E-Mails 540
TMailr.Mail API Reference 541
attachments 542
body 542
date 542
has_attachments? 542
multipart? 542
parts 542
subject 542
to 542
Handling Attachments 543
Configuration 543
Conclusion 544
References 544
Chapter 17 Testing 545
Rails Testing Terminology 546
So Much for Isolation... 547
Contents
Raib Mocks? 548
Real Mocks and Stubs 549
Integration Tests 550
Dealing with the Confusion 551
Test::Unit 552
Running Tests 553
Fixtures 554
CSVFixtures 555
Accessing Fixture Records from Tests 556
Dynamic Fixture Data 556
Using Fixture Data in Development Mode 557
Generating Fixtures from Development Data 558
Fixtures Options 559
Everybody Hates Fixtures 560
Fixtures Make My Test Suite Slow 560
Fixtures Allow Invalid Data 560
Maintainability Challenges 561
Fixtures Are Brittle 561
Fixtures Really Aren t That Bad 562
Assertions 562
Basic Assertions 562
assert and deny 562
assert_block 563
assert_empty 563
assert_equal and assert_not_equal 563
assert_in_delta and assert_in_epsilon 564
assert_include 564
assert_instance_of 564
assert_kind_of 564
assert_match and assert_no_match 564
assert_nil and assert_not_nil 565
assert_same and assert_not_same 565
assert_raise and assert_nothing_raised 565
assert_respond_to 565
flunk 565
Rails Assertions 566
Contents xxxvii
One Assertion per Test Method 566
Testing Models with Unit Tests 568
Model Testing Basics 568
Deciding What to Test 570
Testing Controllers with Functional Tests 570
Structure and Setup 570
Functional Test Methods 571
Common Assertions 572
Assert That Variables Were Assigned Properly for Use by Templates 572
Assert the HTTP Status Code of a Response and Its MIME Content Type 573
Assert the MIME Content Type of a Response (or Other Header Values) 573
Assert Rendering of a Particular Template 574
Assert Redirection to a Specified URL 574
Assert Setting of Flash Messages 574
Assert Database Changes Resulting from Actions 575
Assert Validity of a Model 575
Asserting View Output 576
Testing Views with Functional Tests 576
assert_select(selector, [*values, equality, message, block]) 577
assert_select(element, selector, [Values, equality, message, block]) 577
Optional Block Parameter 577
Selector Reference 578
Equality Tests 580
Testing RJS Behavior 581
assert_select_rjs(*args, block) 581
assert_select_rjs (id) 581
assert^seleccrjsioperation, id) 582
assert_select_rjs(:insert, position, id) 582
Other Selection Methods 582
assert_select_email(*args, block) 582
assert_select_encoded(*args, block) 582
css_select(selector, Values) and css_select(element, selector, Values) 582
Testing Routing Rules 582
assert_generates(expected_path, options, defaults={}, extras = {}, message=nil) 583
assert_recognizes(expected_options, path, extras={}, message=nil) 583
assert_routing(path, options, defaults={}, extras={}, message=nil) 584
xxxviú Comen«
Rails Integration Tests 584
Bushs 584
The Integration Test API 585
assert_rcdirccted_to{optionj « {{. message « nil) 586
asscrt_rcsponsc(tvpc, message « nil) 586
asscrt_templatc(cxpccted = nil, message » nil) 586
Working with Sessions 586
Rake Tasks Related to Testing 587
Acceptance Tests 588
Acceptance Test First? 588
Selenium 589
Basics 589
Actions and Assertions 589
Locators 590
Patterns 590
Selenium Reference 590
Getting Started 591
First Test 591
RSeUnese 592
Partial Scripts 592
Conclusion 593
References 594
Chapter 18 RSpec on Rails 597
Introduction to RSpec 597
Should and Expectations 598
Predicates 599
Custom Expectation Matchers 601
Multiple Examples per Behavior 603
Shared Behaviors 604
RSpec s Mocks and Stubs 607
Mock Objects 607
Null Objects 608
Stub Objects 608
Running Specs 610
Installing RSpec and the RSpec on Rails Plugin 613
The RSpec on Rails Plugin 613
Contents xxxix
Generaton 614
Model Specs 614
Controller Specs 617
Isolation and Integration Modes 619
Specifying Errors 620
Specifying Routes 620
View Specs 621
Assigning Instance Variables 622
Stubbing Helper Methods 623
Helper Specs 623
Scaffolding 623
RSpec Tools 624
Autotest 624
RCov 624
Conclusion 625
References 626
Chapter 19 Extending Rails with Plugins 627
Managing Plugins 628
Reusing Code 628
The Plugin Script 629
script/plugin list 629
script/plugin sources 630
script/plugin source [url [url2 [...]]] 630
script/plugin unsource [url[url2 [...]]] 631
script/plugin discover [url] 631
script/plugin install [plugin] 632
script/plugin remove [plugin) 633
script/plugin update [plugin] 633
Subversion and script/plugin 633
Checking Out a Plugin 634
script/plugin update 634
SVN Externals 635
Locking Down a Specific Version 636
Using Piston 636
Installation 636
Importing a Vendor Library 637
Contenu
Converting Existing Vendor Libraries 3S
Updating 638
Locking and Unlocking Revisions 639
Piston Properties 639
Writing Your Own Plugins 640
The init.rb Hook Ý0
The lib Directory 642
Extending Rails Cluses 643
The README and M f TÚCENSE File 644
The install rb and uninstall rb Files 645
Installation 645
Removal 646
Common Sense Reminder 646
Custom Rake Tasks 647
The Plugins Rakefile 648
Testing Plugins 649
Conclusion 649
References 650
Chapter 20 Rails Production Configurations 651
A Brief History of Rails In Production 652
Some Basic Prerequisites 652
The Stack Checklist 654
Server and Network Environment 655
Standalone/Dedicated Server or VPS Slice 655
Fresh OS Install 655
Network Access 655
Web Tier 656
Application Tier 656
Database Tier 656
Monitoring 657
Version Control 657
Installations 657
Ruby 658
RubyGems 658
Rails 659
¿Mongrel 659
Contents xli
Mongrel Cluster 659
Nginx 659
Subversion 660
MySQL 660
Monit 661
Capistrano 661
Configurations 661
Configuring Mongrel Cluster 662
Configuring Nginx 663
nginx.conf 663
railsway.conf 664
Configuring Monit 667
Configuring Capistrano 670
Configuring init Scripts 670
Nginx init Script 670
Mongrel init Script 672
Monit Configuration 673
Deployment and Launch 675
Other Production Stack Considerations 675
Redundancy and Failover 676
Caching 676
Performance and Scalability 676
Security 677
Application Security 677
Lock Down Your Ports 678
Maintainability 678
Conclusion 678
References 679
Chapter 21 Capistrano 681
Overview of Capistrano 681
Terminology 682
The Basics 682
What Do I Need to Do to Use Capistrano? 682
What Does Capistrano Expect? 683
What Has Capistrano Done and What Hasn t It? 684
Getting Started 684
Contents
Installation 684
Capify Your Rails Application 685
Configuring the Deployment 687
Name Your Application 687
Repository Info 687
Define Roles 687
Extra Role Properties 688
A Little Spin, Please... 688
Set Up the Deployment Machine 689
Deployment Directory Structure 689
Symbolic Links 690
Checking a New Deployment Setup 690
Deploy! 691
Overriding Capistrano Assumptions 691
Using a Remote User Account 691
Customizing the SCM System Used by Capistrano 692
Working without SCM Access from the Deployment Machine 692
What If I Don t Store database.yml in My SCM Repository? 693
Option A: Version It Anyway, but with a Different Name 693
Option B: Store Production-Ready database.yml in the shared/config Folder 694
Option C: The Best Option: Autogenerate database.yml 694
What If My Migrations Won t Run from 0 to 100? 696
Useful Capistrano Recipes 696
Variables and Their Scope 696
Exercise #1: Staging 698
Exercise #2: Managing Other Services 701
Multiserver Deployments 702
Transactions 703
Proxied Access to Deployment Machines 705
Conclusion 706
References 706
Chapter 22 Background Processing 707
script/runner 708
Getting Started 708
Usage Notes 709
script/runner Considerations 710
Contents xlüi
DRb 710
A Simple DRb Server 711 *
Using DRb from Rails 711
DRb Considerations 712
Resources 713
BackgrounDRb 713
Getting Started 713
Configuration 714
Understanding BackgrounDRb 715
Using the MiddleMan 715
Caveats 717
BackGrounDRb Considerations 718
Daemons 719
Usage 719
Introducing Threads 720
Daemon Considerations 722
Conclusion 722
References 722
Appendix A ActiveSupport API Reference 723
Appendix B Rails Essentials 805
Afterword What Is the Rails Way (To You)? 815
|
adam_txt |
Titel: The Rails way
Autor: Fernandez, Obie
Jahr: 2008
xii Contents
Contents
Chapter 1 Rails Environments and Configuration 1
Startup 2
Default Environment Settings 2
Mode Override 2
Rails Gem Version 2
Bootstrapping 3
RubyGems 5
Initializer 6
Default Load Paths 6
Rails, Modules, and Auto-Loading Code 7
Builtin Rails Info 8
Configuration 9
Skipping Frameworks 9
Additional Load Paths 10
Log-Level Override 10
ActiveRecord Session Store 10
Schema Dumper 11
Observers 11
Time Zones 11
Additional Configuration 13
Development Mode 14
Automatic Class Reloading 15
The Rails Class Loader 15
Test Mode 17
Production Mode 17
Logging 18
Rails Log Files 20
Contents xiii
Log File Analysis 22
Sysbg 24
Conclusion 25
References 25
Chapter 2 Working with Controllers 27
The Dispatcher: Where It All Begins 28
Request Handling 28
Getting Intimate with the Dispatcher 29
Render unto View. 31
When in Doubt, Render 32
Explicit Rendering 33
Rendering Another Actions Template 33
Rendering a Different Template Altogether 34
Rendering a Partial Template 35
Rendering Inline Template Code 35
Rendering Text 35
Rendering Other Types of Structured Data 36
:json 36
:xml 36
Rendering Nothing 36
Rendering Options 37
:content_type 37
:layout 37
¡status 37
Redirecting 39
Controller/View Communication 42
Filters 43
Filter Inheritance 44
Filter Types 46
Filter Classes 46
Inline Filter Method 47
Filter Chain Ordering 47
Around Filters 48
Filter Chain Skipping 49
xiv Contents
Filter Conditions 50
Filter Chain Halting 50
Streaming 51
send_data(data, options = {}) 51
Options for send_data 51
Usage Examples 52
send_file(path, options = {}) 52
Options for send_file 53
Usage Examples 55
Letting the Web Server Send Files 55
Conclusion 56
References 56
Chapter 3 Routing 57
The Two Purposes of Routing 58
Bound Parameters 60
Wildcard Components ("Receptors") 61
Static Strings 62
The routes.rb File 63
The Default Route 65
Spotlight on the :id Field 66
Default Route Generation 67
Modifying the Default Route 68
The Ante-Default Route and respond_to 69
respondjto and the HTTP-Accept Header 70
The Empty Route 71
Writing Custom Routes 72
Using Static Strings 72
Using Your Own "Receptors" 73
A Note on Route Order 75
Using Regular Expressions in Routes 76
Default Parameters and the url_for Method 76
What Happened to :id? 77
Using Literal URLs 79
Route Globbing 79
Globbing Key-Value Pairs 80
Named Routes 81
Contents xv
Creating a Named Route 81
The Question of Using name_path Versus name_url 82
Considerations 83
What to Name Your Routes 83
Argument Sugar 84
A Little More Sugar with Your Sugar? 85
The Special Scope Method with_options 86
Conclusion 88
References 88
Chapter 4 REST, Resources, and Rails 89
REST in a Rather Small Nutshell 89
REST in Rails 91
Routing and CRUD 92
Resources and Representations 93
REST Resources and Rails 93
From Named Routes to REST Support 94
Reenter the HTTP Verb 96
The Standard RESTful Controller Actions 96
The PUT and DELETE Cheat 98
Singular and Plural RESTful Routes 98
The Special Pairs: new/create and edit/update 99
Singular Resource Routes 100
Nested Resources 101
Setting :path_prefix Explicitly 103
Setting :name_prefix Explicitly 103
Specifying RESTfiil Controllers Explicitly 105
All Together Now 105
Considerations 107
Deep Nesting? 108
RESTful Route Customizations 110
Extra Member Routes 110
Extra Collection Routes 111
Considerations 112
Controller-Only Resources 113
Different Representations of Resources 115
Contenu
The rtspond_to ¡Method ¡16
Formatted Named Routa ¡17
The RESTful Rails Action Set IV,
Index 118
Show ¡21
Destroy 121
New and Create ¡23
Edit and Update 124
Conclusion 125
Reference 126
Chapter 5 Reflecting on Rails Routing 127
Examining Routes in the Application Console 127
Dumping Routes ¡28
Anatomy of a Route Object 129
Recognition and Generation in the Console 132
Named Routa in the Console ¡34
Testing Routes 135
The Routing Navigator Plugin 136
Conclusion 137
References 137
Chapter 6 Working with ActiveRecord 139
The Basics 140
Migrations 142
Creating Migrations 143
Naming Migrations 144
Migration Pitfalls 145
Migration API 146
create_table(name, options) 147
Defining Columns 149
Column Type Mappings 150
Column Options 151
Decimal Precision 152
Column Type Gotchas 152
Custom Data Types 154
"Magic" Timestamp Columns 154
Macro-Style Methods 155
Relationship Declarations 155
Contents xvii
Convention over Configuration 156
Pluralization 157
Should I Report INFLECTOR Bugs to the Core Team? 158
Setting Names Manually 158
Legacy Naming Schemes 159
Defining Attributes 160
Default Attribute Values 160
Serialized Attributes 162
CRUD: Creating, Reading, Updating, Deleting 163
Creating New ActiveRecord Instances 163
Reading ActivcRecord Objects 164
find 164
Reading and Writing Attributes 166
Hash Notation 167
The attributes Method 168
Accessing and Manipulating Attributes Beßre They Are Typecast 168
Reloading 169
Dynamic Attribute-Based Finders 169
Custom SQL Queries 171
The Query Cache 172
Logging 173
Default Query Caching in Controllers 173
Limitations 174
Updating 174
Updating by Condition 176
Updating a Particular Instance 176
Updating Specific Attributes 177
Convenience Updaten 177
Controlling Access to Attributes 178
Deleting and Destroying 178
Database Locking 179
Optimistic Locking 180
Handling StaleObjectError 181
Pessimistic Locking 182
Considerations 183
Advanced Finding 183
Conditions 183
Boolean Conditions 185
sviii Conten»
Random Ordering 186
Limit and Offset ¡86
Select Option 187
From Option 188
Group By Option ¡88
Locking Option ¡89
Joining and Including Associations ¡89
Read Only 189
Connections to Multiple Databases in Different Models 189
Using the Database Connection Directly 191
The DatabaseStatements Module ¡9Í
begin_db_transaction() 191
commit_db_transaction() 192
delete(sql_statement) 192
execute(sql_statement) 192
insert(sql_statement) 192
reset_sequence!(table, column, sequence = nil) 192
rollback_db_transactionO 192
select_all(sql_statement) 192
select_one(sql_statement) 193
select_value(sql_statement) 193
select_values(sqi_statement) 193
updateCsqLstatement) 193
Other Connection Methods 194
active? 194
adapter_name 195
disconnect! and reconnect! 195
raw_connection 195
supports_count_distinct? 195
supports_migrations? 195
tables 195
verify!(timeout) 196
Other Configuration Options 196
Conclusion 197
References 198
Contents xix
Chapter 7 ActiveRecord Associations 199
The Association Hierarchy 199
One-to-Many Relationships 201
Adding Associated Objects to a Collection 203
AssociationCotiection Methods 204
«('records) and crcateiattributes = |}) 204
clear 205
deleteCrecords) and delcte_all 205
destroy_all 206
length 206
replace(other_array) 206
size 206
sum(column, 'options) 206
uniq 207
The belongs_to Association 207
Reloading the Association 208
Building and Creating Related Objects via the Association 208
belongs_to Options 209
:class_name 209
¡conditions 210
:foreign_key 213
:counter_cache 213
:indude 214
¡polymorphic - true 214
The has_many Association 215
hasjmany Options 216
:after_add 216
:after_remove 216
:as 216
:before_add 217
:before_remove 217
:dass_name 218
¡conditions 218
: coun ter_sql 218
:delete_sql 218
xx Contents
¡dependent = :delete_all 219
¡dependent = :destroy_all 219
¡dependent = ¡nullify 219
:exclusively_dependent 219
¡extend = ExtensionModule 219
:finder_sql 219
¡foreignjcey 219
¡group 220
¡include 220
:insert_sql 223
¡limit 223
¡offset 223
¡order 223
¡select 223
¡source and ¡source_type 223
:table_name 223
¡through 224
¡uniq = true 224
Proxy Methods 224
build(attributes = {}) 224
count(*args) 225
find(*args) 225
Many-to-Many Relationships 225
has_and_belongþ_to_many 225
Self-Referential Relationship 226
Bidirectional Relationships 227
Custom SQL Options 229
Extra Columns on has_and_belongs_to_many Join Tables 232
"Real Join Models" and habtm 232
has_many ¡through 233
Join Models 233
Usage Considerations and Examples 235
Aggregating Associations 236
Join Models and Validations 237
has_many ¡through Options 238
¡source 238
Contents xxi
:source_type 238
:uniq 240
One-to-One Relationships 241
has_one 241
has_one Options 244
:as 244
:class_name 244
xonditions 245
¡dependent 245
:foreign_key 245
.•include 245
¡order 246
Unsaved Objects and Associations 246
One-to-One Associations 246
Collections 247
Association Extensions 247
The AssociationProxy Class 249
reload and reset 249
proxy_owner, proxy_reflection, and proxy_target 249
Conclusion 250
References 251
Chapter 8 ActiveRecord Validations 253
Finding Errors 253
The Simple Declarative Validations 254
validates_acceptance_of 254
Error Message 255
The accept Option 255
validates_associated 255
validates_confirmation_of 256
validates_each 256
validates_inclusion_of and validates_exclusion_of 257
validates_existence_of 257
validates_format_of 258
validates_length_of 259
xxii Contents
Constraint Options 260
Error Message Options 260
validates_numericality_of 260
validates_presence_of 261
Validating the Presence of Associated Objects 261
validates_uniqueness_of 261
Enforcing Uniqueness of Join Models 262
Recordlnvalid 263
Common Validation Options 263
:allow_nil 263
:if 263
¦.message 263
:on 264
Conditional Validation 264
Usage and Considerations 265
Working with the Errors Object 266
Manipulating the Errors Collection 267
add_to_base(msg) 267
add(attribute, msg) 267
clear 267
Checking for Errors 267
invalid?(attribute) 267
on(attribute) 267
Custom Validation 268
Skipping Validations 269
Conclusion 270
Reference 270
Chapter 9 Advanced ActiveRecord 271
Callbacks 271
Callback Registration 272
One-Liners 273
Protected or Private 273
Matched before/after Callbacks 274
List of Callbacks 274
Halting Execution 274
Contents xxiii
Callback Usages 275
Cleaning Up Attribute Formatting with before_validate_on_create 275
Geocoding with before_save 275
Paranoia with before_destroy 277
Cleaning Up Associated Files with after_destroy 277
Special Callbacks: afier_initialize and afier_find 278
Callback Classes 279
Multiple Callback Methods in One Class 280
Testability 282
Observers 282
Naming Conventions 283
Registration of Observers 283
Timing 284
Single-Table Inheritance (STI) 284
Mapping Inheritance to the Database 286
STI Considerations 288
STI and Associations 288
Abstract Base Model Classes 291
Polymorphic has_many Relationships 292
In the Case of Models with Comments 293
The Interface 293
The Database Columns 294
Has_many ¡through and Polymorphics 295
Considerations about has_many 296
Modules for Reusing Common Behavior 296
A Review of Class Scope and Contexts 299
The included Callback 300
Modifying ActiveRecord Classes at Runtime 301
Considerations 303
Ruby and Domain-Specific Languages 303
Conclusion 305
References 305
Chapter 10 ActionView 307
ERb Basics 308
ERb Practice 308
Tightening Up ERb Output 310
Contents
Commenting Out ERb Delimiters 310
Conditional Output 311
RHTML? RXMU RJS? 311
Layouts and Templates 312
Yielding Content 313
Template Variables 315
Instance Variables 315
assigns 316
base_path 316
controller 316
flash 317
headers 318
logger 318
params 319
request and response 319
session 319
Protecting the Integrity of Your View from User-Submitted Content 319
Partíais 320
Simple Use Cases 321
Reuse ofPartials 322
Shared Partíais 323
Passing Variables to Partíais 324
The local_assigns Hash 325
Render Collections 325
The partial_counter Variable 326
Sharing Collection Partíais 326
Logging 327
Caching 327
Caching in Development Mode? 328
Page Caching 328
Action Caching 328
Design Considerations 329
Fragment Caching 330
The cache Method 330
Named Fragments 331
Global Fragments 332
Contents
Avoiding Extra Database Activity 333
Expiration of Cached Content 333
Expiring Pages and Actions 333
Expiring Fragments 334
Using regular expressions in expiration calls 334
Automatic Cache Expiry with Sweepers 335
Cache Logging 337
Action Cache Plugin 337
Cache Storage 338
Configuration Example 339
Limitations of File-Based Storage 339
Manual Sweeping with rake 339
Conclusion 340
References 340
Chapter 11 All About Helpers 341
ActiveRecordHelper 342
Reporting Validation Errors 342
error_message_on(object, method, prepend_text = "", append_text = "", css_class ¦
"formError") 342
error_messages_for(*params) 343
Automatic Form Creation 344
form(name, options) 344
input(name, method, options) 346
Customizing the Way Validation Errors Are Highlighted 346
AssetTagHelper 348
Head Helpers 348
auto_discovery_link_tag(tvpe = :rss, url_options = {}, tag_options = {}) 348
image_path(source) 350
image_tag(source, options = {}) 350
javascript_include_tag(*sources) 351
javascript_path(source) 352
stylesheet_link_tag(*sources) 352
stylesheet_path(source) 352
For Plugins Only, Add Default JavaScript Includes 352
Contents
BenchmarkHelper 353
benchmarkímessage = "Benchmarking", level = :info) 353
CacheHelper 353
CaptureHelper 354
capture( block) 354
content_for(name, block) 354
DateHelper 355
The Date and Time Selection Helpers 355
date_select(object_name, method, options = {}) 355
datetime_select(object_name, method, options = {}) 356
time_select(object_name, method, options = {}) 356
The Individual Date and Time Select Helpers 356
select_date(date = Date.today, options = {}) 357
select.datetimeidatetime = Time.now, options = {}) 357
selec^dayidate, options = {}) 357
select_hour(datetime, options = {}) 357
select_minute(datetime, options = {}) 357
select_month(date, options = {}) 358
select_second(datetime, options = {}) 358
select_time(datetime, options = {}) 358
select_year(date, options = {}) 359
Common Options for Date Selection Helpers 359
distance_in_time Methods with Complex Descriptive Names 359
distance_of_time_in_words(from_time, to_time = 0, include_seconds = false) 360
distance_of_time_in_words_to_now(from_time, indude_seconds = false) 361
DebugHelper 361
FormHelper 362
Creating Forms for ActiveRecord Models 362
Variables Are Optional 363
Rails-Generated Form Conventions 363
Displaying Existing Values 364
Updating Multiple Objects at Once 364
Square Brackets with New Records? 365
Indexed Input Fields 366
Faux Accessors 369
How Form Helpers Get Their Values 370
FormOptionsHelper 371
Contents xxvü
Select Helpers 371
coUection_select(object, attribute, collection, value_method, text_method, options = {},
html_options = {}) 372
country_select(object, attribute, priority_countries = nil, options = {}, html_options = {})
372
selectCobject, attribute, choices, options = {}, html_options = {}) 372
time_zone_select(object, method, priority_zones = nil, options = {}, html_options = {}) 373
Option Helpers 373
country_options_for_select(selected = nil, priority_countries = nil) 373
option_groups_from_collection_for_select(collection, group_method, group_label_method,
option_key_method, option_value_method, selected_key = nil) 373
options_for_select(container, selected = nil) 375
options_from_collection_fbr_select(collection, value_method, text_method, selected=nil)
377
time_zone_options_for_select(selected = nil, priority_ zones = nil, model = TimeZone) 377
FormTagHelper 378
check_box_tag(name, value = "1", checked = false, options = {}) 378
end_form_tag 378
file_field_tag(name, options = {}) 378
form_tag(url_fbr_options = {}, options = {}, *parameters_for_url, block) 379
hidden_field_tag(name, value = nil, options = {}) 380
image_submit_tag(source, options = {)) 380
password_field_tag(name = "password", value = nil, options = {}) 380
radio_button_tag(name, value, checked = false, options = {}) 380
select_tag(name, option_tags = nil, options = {}) 380
start_form_tag 380
submit_tag(value = "Save changes", options = {}) 381
text_area_tag(name, content = nil, options = {}) 381
text_field_tag(name, value = nil, options = {}) 381
JavaScriptHelper 381
button_to_function(name, function, html_options={}, block) 381
defincjavascriptjfunctionsO 382
escape.javascriptQavascript) 382
javascript_tag(content, html_options={}) 382
link_to_function(name, function, html_options={}, block) 382
NumberHelper 383
human_size(size, precision=l) 383
number_to_currency(number, options = {}) 383
xxviii Contents
number_to_human_size(size, precision=l) 384
number_to_percentage(number, options = {}) 384
number_to_phone(number, options = {}) 385
number_with_delimiter(number, delimiter=",", separator=".") 385
number_with_precision(number, precision=3) 385
PaginationHelper 386
tuill_paginate 386
paginator 387
Paginating Find 388
RecordldentificationHelper 388
dom_class(record_or_class, prefix = nil) 389
dom_id(record, prefix = nil) 389
partial_path(record_or_class) 389
RecordTagHelper 390
content_tag_for(tag_name, record, *args, block) 390
div_for(record, *args, block) 391
TagHelper 391
cdata_section(content) 391
content_tag(name, content = nil, options = nil, Síblock) 391
escape_once(html) 392
tag(name, options = nil, open = false) 392
TextHelper 393
auto_link(text, link = :all, href_options = {}, block) 393
concatCstring, binding) 393
cycle(first_value, Values) 394
excerpt(text, phrase, radius = 100, excerpt_string = ".") 395
highlight(text, phrases, highlighter = ' strong class="highlight" \l /strong ') 395
markdown(text) 396
pluralize(count, singular, plural = nil) 396
reset_cyde(name = "default") 397
sanitize(html) 397
simple_format(text) 398
strip_links(text) 398
strip_tags(html) 398
textilize(text) 399
textilize_without_paragraph(text) 399
Contents xxix
truncate (text, length = 30, truncate_string = ".") 399
word_wrap(text, line_width = 80) 400
UrlHelper 400
button_to(name, options = {}, html_options = {}) 400
current_page?(options) 401
link_to(name, options = {}, html_options = nil) 401
link_to_if(condition, name, options = {}, html_options = {}, block) 403
link_to_unless(condition, name, options = {}, html_options = {}, block) 403
link_to_unless_current(name, options = {}, html_options = {}, block) 403
mail_to(email_address, name = nil, html_options = {}) 404
url_for(options = {}) 405
Relying on Named Routes 406
Writing Your Own Helpers 407
Small Optimizations: The Title Helper 407
Encapsulating View Logic: The photo_for Helper 408
Smart View: The breadcrumbs Helper 409
Wrapping and Generalizing Partíais 410
A tiles Helper 410
Explanation of the Tiles Partial Code 411
Calling the Tiles Partial Code 412
Write the Helper Method 413
Generalizing Partíais 414
Lambda: the Ultimate 414
The New Tiled Helper Method 415
Conclusion 417
References 417
Chapter 12 Ajax on Rails 419
Prototype 420
FireBug 421
The Prototype API 421
Top-Level Functions 422
$(id[, id2.]) 422
$$(expr[, expr2.]) 423
$A(var) 423
$F(id) 423
Contents
$H(obj) 423
$R(start, end, exclusive) 423
Try.theseCfuncl, func2[, fUnc3.] 423
Class 424
Extensions to JavaScript's Object Class 425
Object.cloneCobject) 425
Object.extendCdestination, source) 425
Object.keys(obj) and Object.values(obj) 425
Object.inspectCparam) 426
Extensions to JavaScripts Array Class 426
array.clearO 426
array.compactO 426
array.firstO and array.last() 426
array.flattenO 427
array.indexOf(object) 427
array.inspectO 427
array.reverse(inline) 427
array.shiftO 428
array.without(obj 1 [, obj2, .]) 428
Extensions to the document Object 428
Extensions to the Event Class 428
Event.elementO 429
Event.findElement(event, tagName) 429
Event.isLeftClickCevent) 429
Event.observe(element, name, observer, useCapture) and Event.stopObserving(element,
name, observer, useCapture) 429
Event.pointerX(event) and Event.pointerY(event) 430
Event.stop(event) 430
Extensions to JavaScripts Function Class 430
function.bind(obj) 430
function.bindAsEventListener(obj) 431
Extensions to JavaScript's Number Class 432
number.toColorPartO 432
number.succO 433
number.timesO 433
Extensions to JavaScript's String class 433
string.camelizeO 433
Contents
string.dasherizeO 434
string.escapeHTMLO and string.unescapeHTML() 434
string.evalScriptsO and string.extractScriptsO 434
string.gsub(pattern, replacement) and string.sub(pattern, replacement, count) 434
string.scan(pattern, iterator) 434
string.stripO 435
string.stripScriptsO and string.stripTags() 435
string.parseQueryO and string.toQueryParams() 435
string.toArrayO 435
string.truncate(length, truncationString) 435
string. underscoreO 436
The Ajax Object 436
Ajax.activeRequestCount 436
Ajax.getTransportO 436
Ajax. Responden 437
Ajax.Responders.registerCresponder) 437
Ajax.Responders.unregister(responder) 437
Enumerable 437
enumerable.eachíiterator) 438
enumerable.all(iterator) 438
enumerable.any(iterator) 438
enumerable.collectCiterator) and enumerable.map(iterator) 439
enumerable.detect(iterator) and enumerable.find(iterator) 439
enumerable.eachSliceinumberf, iterator]) 439
enumerable.findAll(iterator) and enumerable.selectiiterator) 439
enumerable.grep(pattern[, iterator]) 440
enumerable.include(obj) and enumerable.memberiobj) 440
enumerable.inGroupsOf(num[, filier]) 440
enumerable.injectCaccumulator, iterator) 441
enumerable.invokeifunctionNamef, argl, arg2.]) 441
enumerable.maxífiterator]) and enumerable.minífiterator]) 441
enumerable.partitionCfiterator]) 441
enumerable.pluckipropertyName) 442
enumerable.rejectiiterator) 442
enumerable.sortBy(iterator) 442
enumerable.toArrayO and enumerable.entriesQ 442
Contenu
enumerable.zip(enuml. enum2[. cnum3.][. iterator!) 4*13
Hash 44J
rush.keyiO and ha, h.va!uîs() 443
ru.ih.merge(another) 443
rush.toQueryStringO 444
Objfctfünjrr 444
Tht Prvtotypt Ohjtct 445
The Prototype Helper Module 44 S
link_tojrtmott 445
rrmote_form_^üT 449
ptripdicýilly_cali_rrmott 451
obsent_field 45 t
observe_firm 453
RJS—Writing Javascript in Ruhr 453
RJS TempLitet 455
(javascript) 456
[](,d) 457
alm(mtssagt) 457
callifunction, ^arguments, óilm-k} 45~
delayisetonds * I) f. } 458
draggahle(id, options = {}) 458
drop_receivingfid, options = {}) 458
hideCids) 458
insert_html(position, id, *eptions_fir_rrndrr) 458
¡iteral(code) 459
rrdirtct_to(location) 459
removeCids) 459
replacefid, *options_for_rrnder) 460
rrplace_btml(id, *options_fir_rendtr) 460
selfctfpattern) 460
show(*ids) 460
sortable(id\ options = {}) 460
toggüCids) 461
vùuaLeffiafname, id = nil, options = {}) 461
JSON 461
Drag and Drop 463
Contents xxxiii
Sonable 465
Autocompletcr 466
In-Placc Editors 467
Conclusion 467
References 468
Chapter 13 Session Management 469
What to Store in the Session 470
The Current User 470
Session Use Guidelines 470
Session Options 471
Disabling Sessions fir Robots 472
Selectively Enabling Sessions 473
Secure Sessions 473
Storage Mechanisms 473
ActiveRecord SessionStore 473
PStore (File-Based) 474
DRb Session Storage 475
memcache Session Storage 475
The Controversial CookieStore 476
Timing Out and Session Life Cycle 478
Session Timeout Plugin for Rails 478
Tracking Active Sessions 479
Enhanced Session Security 480
Cleaning Up Old Sessions 481
Cookies 481
Reading and Writing Cookies 482
Conclusion 483
References 483
Chapter 14 Login and Authentication 485
Acts as Authenticated 486
Installation and Setup 486
The User Model 487
Non-Database Attributes 490
Validations 492
The before_save Callback 493
The authenticate Method 494
The remember_token 495
«xiv Onu«»
The Account (,i"I.*nW«" "f ';f
Loçtifrom Cookie -i'.W
The Curren! User 499
Losging In During Testing ^01
Conclusion 502
References 502
Chapter 15 XML and ÂctiveResource 503
The to_xm! Method 503
Customizing to_xm! Output Wi
Associations and to_xml 50 ~
Advanced to_xm¡ 503
Dynamic Runtime Atinbutrt 509
Overriding to_xml 510
Learning from Array's to_xrn! Mtthid $¡0
The XML Builder 513
Parsing XML 515
TurningX¡\fL into Hashes 5/5
KmlSimple 516
Typecasting 518
ÂctiveResource 519
Find 519
Create 522
Update 524
Delete 524
Headers 526
Customizing 527
Hash Forms 528
Conclusion 529
Chapter 16 ActionMailer 531
Setup 531
Mailer Models 532
Preparing Outbound Email Messages 533
attachment 534
bec 534
bodv 534
Contents xxxv
cc 534
charset 534
content_type 534
from 534
headers 534
impl¡cit_parts_order 535
mailer_name 535
mime_version 535
part 535
recipients 535
sent_on 536
subject 536
template 536
HTML Email Messages 536
Multipart Messages 537
Part Options 538
Implicit Multipart Messages 539
File Attachments 539
Actually Sending an Email 540
Receiving E-Mails 540
TMailr.Mail API Reference 541
attachments 542
body 542
date 542
has_attachments? 542
multipart? 542
parts 542
subject 542
to 542
Handling Attachments 543
Configuration 543
Conclusion 544
References 544
Chapter 17 Testing 545
Rails Testing Terminology 546
So Much for Isolation. 547
Contents
Raib Mocks? 548
Real Mocks and Stubs 549
Integration Tests 550
Dealing with the Confusion 551
Test::Unit 552
Running Tests 553
Fixtures 554
CSVFixtures 555
Accessing Fixture Records from Tests 556
Dynamic Fixture Data 556
Using Fixture Data in Development Mode 557
Generating Fixtures from Development Data 558
Fixtures Options 559
Everybody Hates Fixtures 560
Fixtures Make My Test Suite Slow 560
Fixtures Allow Invalid Data 560
Maintainability Challenges 561
Fixtures Are Brittle 561
Fixtures Really Aren't That Bad 562
Assertions 562
Basic Assertions 562
assert and deny 562
assert_block 563
assert_empty 563
assert_equal and assert_not_equal 563
assert_in_delta and assert_in_epsilon 564
assert_include 564
assert_instance_of 564
assert_kind_of 564
assert_match and assert_no_match 564
assert_nil and assert_not_nil 565
assert_same and assert_not_same 565
assert_raise and assert_nothing_raised 565
assert_respond_to 565
flunk 565
Rails Assertions 566
Contents xxxvii
One Assertion per Test Method 566
Testing Models with Unit Tests 568
Model Testing Basics 568
Deciding What to Test 570
Testing Controllers with Functional Tests 570
Structure and Setup 570
Functional Test Methods 571
Common Assertions 572
Assert That Variables Were Assigned Properly for Use by Templates 572
Assert the HTTP Status Code of a Response and Its MIME Content Type 573
Assert the MIME Content Type of a Response (or Other Header Values) 573
Assert Rendering of a Particular Template 574
Assert Redirection to a Specified URL 574
Assert Setting of Flash Messages 574
Assert Database Changes Resulting from Actions 575
Assert Validity of a Model 575
Asserting View Output 576
Testing Views with Functional Tests 576
assert_select(selector, [*values, equality, message, block]) 577
assert_select(element, selector, [Values, equality, message, block]) 577
Optional Block Parameter 577
Selector Reference 578
Equality Tests 580
Testing RJS Behavior 581
assert_select_rjs(*args, block) 581
assert_select_rjs (id) 581
assert^seleccrjsioperation, id) 582
assert_select_rjs(:insert, position, id) 582
Other Selection Methods 582
assert_select_email(*args, block) 582
assert_select_encoded(*args, block) 582
css_select(selector, Values) and css_select(element, selector, Values) 582
Testing Routing Rules 582
assert_generates(expected_path, options, defaults={}, extras = {}, message=nil) 583
assert_recognizes(expected_options, path, extras={}, message=nil) 583
assert_routing(path, options, defaults={}, extras={}, message=nil) 584
xxxviú Comen«
Rails Integration Tests 584
Bushs 584
The Integration Test API 585
assert_rcdirccted_to{optionj « {{. message « nil) 586
asscrt_rcsponsc(tvpc, message « nil) 586
asscrt_templatc(cxpccted = nil, message » nil) 586
Working with Sessions 586
Rake Tasks Related to Testing 587
Acceptance Tests 588
Acceptance Test First? 588
Selenium 589
Basics 589
Actions and Assertions 589
Locators 590
Patterns 590
Selenium Reference 590
Getting Started 591
First Test 591
RSeUnese 592
Partial Scripts 592
Conclusion 593
References 594
Chapter 18 RSpec on Rails 597
Introduction to RSpec 597
Should and Expectations 598
Predicates 599
Custom Expectation Matchers 601
Multiple Examples per Behavior 603
Shared Behaviors 604
RSpec's Mocks and Stubs 607
Mock Objects 607
Null Objects 608
Stub Objects 608
Running Specs 610
Installing RSpec and the RSpec on Rails Plugin 613
The RSpec on Rails Plugin 613
Contents xxxix
Generaton 614
Model Specs 614
Controller Specs 617
Isolation and Integration Modes 619
Specifying Errors 620
Specifying Routes 620
View Specs 621
Assigning Instance Variables 622
Stubbing Helper Methods 623
Helper Specs 623
Scaffolding 623
RSpec Tools 624
Autotest 624
RCov 624
Conclusion 625
References 626
Chapter 19 Extending Rails with Plugins 627
Managing Plugins 628
Reusing Code 628
The Plugin Script 629
script/plugin list 629
script/plugin sources 630
script/plugin source [url [url2 [.]]] 630
script/plugin unsource [url[url2 [.]]] 631
script/plugin discover [url] 631
script/plugin install [plugin] 632
script/plugin remove [plugin) 633
script/plugin update [plugin] 633
Subversion and script/plugin 633
Checking Out a Plugin 634
script/plugin update 634
SVN Externals 635
Locking Down a Specific Version 636
Using Piston 636
Installation 636
Importing a Vendor Library 637
" Contenu
Converting Existing Vendor Libraries 3S
Updating 638
Locking and Unlocking Revisions 639
Piston Properties 639
Writing Your Own Plugins 640
The init.rb Hook Ý0
The lib Directory 642
Extending Rails Cluses 643
The README and M f TÚCENSE File 644
The install rb and uninstall rb Files 645
Installation 645
Removal 646
Common Sense Reminder 646
Custom Rake Tasks 647
The Plugins Rakefile 648
Testing Plugins 649
Conclusion 649
References 650
Chapter 20 Rails Production Configurations 651
A Brief History of Rails In Production 652
Some Basic Prerequisites 652
The Stack Checklist 654
Server and Network Environment 655
Standalone/Dedicated Server or VPS Slice 655
Fresh OS Install 655
Network Access 655
Web Tier 656
Application Tier 656
Database Tier 656
Monitoring 657
Version Control 657
Installations 657
Ruby 658
RubyGems 658
Rails 659
¿Mongrel 659
Contents xli
Mongrel Cluster 659
Nginx 659
Subversion 660
MySQL 660
Monit 661
Capistrano 661
Configurations 661
Configuring Mongrel Cluster 662
Configuring Nginx 663
nginx.conf 663
railsway.conf 664
Configuring Monit 667
Configuring Capistrano 670
Configuring init Scripts 670
Nginx init Script 670
Mongrel init Script 672
Monit Configuration 673
Deployment and Launch 675
Other Production Stack Considerations 675
Redundancy and Failover 676
Caching 676
Performance and Scalability 676
Security 677
Application Security 677
Lock Down Your Ports 678
Maintainability 678
Conclusion 678
References 679
Chapter 21 Capistrano 681
Overview of Capistrano 681
Terminology 682
The Basics 682
What Do I Need to Do to Use Capistrano? 682
What Does Capistrano Expect? 683
What Has Capistrano Done and What Hasn't It? 684
Getting Started 684
Contents
Installation 684
"Capify" Your Rails Application 685
Configuring the Deployment 687
Name Your Application 687
Repository Info 687
Define Roles 687
Extra Role Properties 688
A Little Spin, Please. 688
Set Up the Deployment Machine 689
Deployment Directory Structure 689
Symbolic Links 690
Checking a New Deployment Setup 690
Deploy! 691
Overriding Capistrano Assumptions 691
Using a Remote User Account 691
Customizing the SCM System Used by Capistrano 692
Working without SCM Access from the Deployment Machine 692
What If I Don't Store database.yml in My SCM Repository? 693
Option A: Version It Anyway, but with a Different Name 693
Option B: Store Production-Ready database.yml in the shared/config Folder 694
Option C: The Best Option: Autogenerate database.yml 694
What If My Migrations Won't Run from 0 to 100? 696
Useful Capistrano Recipes 696
Variables and Their Scope 696
Exercise #1: Staging 698
Exercise #2: Managing Other Services 701
Multiserver Deployments 702
Transactions 703
Proxied Access to Deployment Machines 705
Conclusion 706
References 706
Chapter 22 Background Processing 707
script/runner 708
Getting Started 708
Usage Notes 709
script/runner Considerations 710
Contents xlüi
DRb 710
A Simple DRb Server 711 *
Using DRb from Rails 711
DRb Considerations 712
Resources 713
BackgrounDRb 713
Getting Started 713
Configuration 714
Understanding BackgrounDRb 715
Using the MiddleMan 715
Caveats 717
BackGrounDRb Considerations 718
Daemons 719
Usage 719
Introducing Threads 720
Daemon Considerations 722
Conclusion 722
References 722
Appendix A ActiveSupport API Reference 723
Appendix B Rails Essentials 805
Afterword What Is the Rails Way (To You)? 815 |
any_adam_object | 1 |
any_adam_object_boolean | 1 |
author | Fernandez, Obie |
author_GND | (DE-588)134112997 |
author_facet | Fernandez, Obie |
author_role | aut |
author_sort | Fernandez, Obie |
author_variant | o f of |
building | Verbundindex |
bvnumber | BV023244719 |
callnumber-first | Q - Science |
callnumber-label | QA76 |
callnumber-raw | QA76.64 |
callnumber-search | QA76.64 |
callnumber-sort | QA 276.64 |
callnumber-subject | QA - Mathematics |
classification_rvk | ST 253 |
classification_tum | DAT 368f DAT 677f DAT 315f |
ctrlnum | (OCoLC)263704961 (DE-599)BSZ275502686 |
dewey-full | 005.117 |
dewey-hundreds | 000 - Computer science, information, general works |
dewey-ones | 005 - Computer programming, programs, data, security |
dewey-raw | 005.117 |
dewey-search | 005.117 |
dewey-sort | 15.117 |
dewey-tens | 000 - Computer science, information, general works |
discipline | Informatik |
discipline_str_mv | Informatik |
edition | 2. print. |
format | Book |
fullrecord | <?xml version="1.0" encoding="UTF-8"?><collection xmlns="http://www.loc.gov/MARC21/slim"><record><leader>01790nam a2200505 c 4500</leader><controlfield tag="001">BV023244719</controlfield><controlfield tag="003">DE-604</controlfield><controlfield tag="005">20080514 </controlfield><controlfield tag="007">t</controlfield><controlfield tag="008">080408s2008 a||| |||| 00||| eng d</controlfield><datafield tag="010" ind1=" " ind2=" "><subfield code="a">2007039880</subfield></datafield><datafield tag="020" ind1=" " ind2=" "><subfield code="a">0321445619</subfield><subfield code="c">pbk. : alk. paper</subfield><subfield code="9">0-321-44561-9</subfield></datafield><datafield tag="020" ind1=" " ind2=" "><subfield code="a">9780321445612</subfield><subfield code="9">978-0-321-44561-2</subfield></datafield><datafield tag="024" ind1="3" ind2=" "><subfield code="a">9780321445612</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(OCoLC)263704961</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(DE-599)BSZ275502686</subfield></datafield><datafield tag="040" ind1=" " ind2=" "><subfield code="a">DE-604</subfield><subfield code="b">ger</subfield></datafield><datafield tag="041" ind1="0" ind2=" "><subfield code="a">eng</subfield></datafield><datafield tag="049" ind1=" " ind2=" "><subfield code="a">DE-91G</subfield></datafield><datafield tag="050" ind1=" " ind2="0"><subfield code="a">QA76.64</subfield></datafield><datafield tag="082" ind1="0" ind2=" "><subfield code="a">005.117</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">ST 253</subfield><subfield code="0">(DE-625)143628:</subfield><subfield code="2">rvk</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">DAT 368f</subfield><subfield code="2">stub</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">DAT 677f</subfield><subfield code="2">stub</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">DAT 315f</subfield><subfield code="2">stub</subfield></datafield><datafield tag="100" ind1="1" ind2=" "><subfield code="a">Fernandez, Obie</subfield><subfield code="e">Verfasser</subfield><subfield code="0">(DE-588)134112997</subfield><subfield code="4">aut</subfield></datafield><datafield tag="245" ind1="1" ind2="0"><subfield code="a">The Rails way</subfield><subfield code="b">[covers Rails 2.0]</subfield><subfield code="c">Obie Fernandez</subfield></datafield><datafield tag="250" ind1=" " ind2=" "><subfield code="a">2. print.</subfield></datafield><datafield tag="264" ind1=" " ind2="1"><subfield code="a">Upper Saddle River, NJ [u.a.]</subfield><subfield code="b">Addison Wesley</subfield><subfield code="c">2008</subfield></datafield><datafield tag="300" ind1=" " ind2=" "><subfield code="a">LIX, 851 S.</subfield><subfield code="b">Ill.</subfield></datafield><datafield tag="336" ind1=" " ind2=" "><subfield code="b">txt</subfield><subfield code="2">rdacontent</subfield></datafield><datafield tag="337" ind1=" " ind2=" "><subfield code="b">n</subfield><subfield code="2">rdamedia</subfield></datafield><datafield tag="338" ind1=" " ind2=" "><subfield code="b">nc</subfield><subfield code="2">rdacarrier</subfield></datafield><datafield tag="490" ind1="0" ind2=" "><subfield code="a">Addison-Wesley professional ruby series</subfield></datafield><datafield tag="500" ind1=" " ind2=" "><subfield code="a">Includes index</subfield></datafield><datafield tag="630" ind1="0" ind2="4"><subfield code="a">Ruby on rails (Electronic resource)</subfield></datafield><datafield tag="650" ind1=" " ind2="4"><subfield code="a">Object-oriented programming (Computer science)</subfield></datafield><datafield tag="650" ind1=" " ind2="4"><subfield code="a">Ruby (Computer program language)</subfield></datafield><datafield tag="650" ind1=" " ind2="4"><subfield code="a">Web site development</subfield></datafield><datafield tag="650" ind1=" " ind2="4"><subfield code="a">Application softare / Development</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">Ruby on Rails</subfield><subfield code="0">(DE-588)7516633-1</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="689" ind1="0" ind2="0"><subfield code="a">Ruby on Rails</subfield><subfield code="0">(DE-588)7516633-1</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="0" ind2=" "><subfield code="5">DE-604</subfield></datafield><datafield tag="856" ind1="4" ind2="2"><subfield code="m">HBZ Datenaustausch</subfield><subfield code="q">application/pdf</subfield><subfield code="u">http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=016430200&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA</subfield><subfield code="3">Inhaltsverzeichnis</subfield></datafield><datafield tag="999" ind1=" " ind2=" "><subfield code="a">oai:aleph.bib-bvb.de:BVB01-016430200</subfield></datafield></record></collection> |
id | DE-604.BV023244719 |
illustrated | Illustrated |
index_date | 2024-07-02T20:25:16Z |
indexdate | 2024-07-09T21:13:59Z |
institution | BVB |
isbn | 0321445619 9780321445612 |
language | English |
lccn | 2007039880 |
oai_aleph_id | oai:aleph.bib-bvb.de:BVB01-016430200 |
oclc_num | 263704961 |
open_access_boolean | |
owner | DE-91G DE-BY-TUM |
owner_facet | DE-91G DE-BY-TUM |
physical | LIX, 851 S. Ill. |
publishDate | 2008 |
publishDateSearch | 2008 |
publishDateSort | 2008 |
publisher | Addison Wesley |
record_format | marc |
series2 | Addison-Wesley professional ruby series |
spelling | Fernandez, Obie Verfasser (DE-588)134112997 aut The Rails way [covers Rails 2.0] Obie Fernandez 2. print. Upper Saddle River, NJ [u.a.] Addison Wesley 2008 LIX, 851 S. Ill. txt rdacontent n rdamedia nc rdacarrier Addison-Wesley professional ruby series Includes index Ruby on rails (Electronic resource) Object-oriented programming (Computer science) Ruby (Computer program language) Web site development Application softare / Development Ruby on Rails (DE-588)7516633-1 gnd rswk-swf Ruby on Rails (DE-588)7516633-1 s DE-604 HBZ Datenaustausch application/pdf http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=016430200&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA Inhaltsverzeichnis |
spellingShingle | Fernandez, Obie The Rails way [covers Rails 2.0] Ruby on rails (Electronic resource) Object-oriented programming (Computer science) Ruby (Computer program language) Web site development Application softare / Development Ruby on Rails (DE-588)7516633-1 gnd |
subject_GND | (DE-588)7516633-1 |
title | The Rails way [covers Rails 2.0] |
title_auth | The Rails way [covers Rails 2.0] |
title_exact_search | The Rails way [covers Rails 2.0] |
title_exact_search_txtP | The Rails way [covers Rails 2.0] |
title_full | The Rails way [covers Rails 2.0] Obie Fernandez |
title_fullStr | The Rails way [covers Rails 2.0] Obie Fernandez |
title_full_unstemmed | The Rails way [covers Rails 2.0] Obie Fernandez |
title_short | The Rails way |
title_sort | the rails way covers rails 2 0 |
title_sub | [covers Rails 2.0] |
topic | Ruby on rails (Electronic resource) Object-oriented programming (Computer science) Ruby (Computer program language) Web site development Application softare / Development Ruby on Rails (DE-588)7516633-1 gnd |
topic_facet | Ruby on rails (Electronic resource) Object-oriented programming (Computer science) Ruby (Computer program language) Web site development Application softare / Development Ruby on Rails |
url | http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=016430200&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA |
work_keys_str_mv | AT fernandezobie therailswaycoversrails20 |