Rails Cookbook
, by Orsini, Rob- ISBN: 9780596527310 | 0596527314
- Cover: Paperback
- Copyright: 1/1/2007
Rob Orsini is the author of the Rails Cookbook (O'Reilly). He's also the founder and CEO of Tuple Shop, Inc., a web software consulting company specializing in Rails and Python development. Previously, Rob was webmaster at Industrial Light & Magic (a Lucasfilm company), and software engineer at O'Reilly Media. Rob has been programming the web since the late nineties, and enjoys the leading edge of development with dynamic languages such as Ruby and Python. Additionally, Rob is a jazz musician, a builder, and a loving husband and father.
Foreword | p. xi |
Preface | p. xiii |
Getting Started | p. 1 |
Joining the Rails Community | p. 2 |
Finding Documentation | p. 4 |
Installing MySQL | p. 5 |
Installing PostgreSQL | p. 8 |
Installing Rails | p. 10 |
Fixing Ruby and Installing Rails on OS X 10.4 Tiger | p. 12 |
Running Rails in OS X with Locomotive | p. 14 |
Running Rails in Windows with Instant Rails | p. 16 |
Updating Rails with RubyGems | p. 18 |
Getting Your Rails Project into Subversion | p. 19 |
Rails Development | p. 23 |
Creating a Rails Project | p. 23 |
Jump-Starting Development with Scaffolding | p. 26 |
Speeding Up Rails Development with Mongrel | p. 28 |
Enhancing Windows Development with Cygwin | p. 31 |
Understanding Pluralization Patterns in Rails | p. 32 |
Developing Rails in OS X with TextMate | p. 36 |
Cross-Platform Developing with RadRails | p. 37 |
Installing and Running Edge Rails | p. 38 |
Setting Up Passwordless Authentication with SSH | p. 41 |
Generating RDoc for Your Rails Application | p. 42 |
Creating Full-Featured CRUD Applications with Streamlined | p. 45 |
Active Record | p. 49 |
Setting Up a Relational Database to Use with Rails | p. 50 |
Programmatically Defining Database Schema | p. 54 |
Developing Your Database with Migrations | p. 56 |
Modeling a Database with Active Record | p. 60 |
Inspecting Model Relationships from the Rails Console | p. 63 |
Accessing Your Data via Active Record | p. 66 |
Retrieving Records with find | p. 68 |
Iterating Over an Active Record Result Set | p. 71 |
Retrieving Data Efficiently with Eager Loading | p. 74 |
Updating an Active Record Object | p. 77 |
Enforcing Data Integrity with Active Record Validations | p. 81 |
Executing Custom Queries with find_by_sql | p. 84 |
Protecting Against Race Conditions with Transactions | p. 88 |
Adding Sort Capabilities to a Model with acts_as_list | p. 92 |
Performing a Task Whenever a Model Object Is Created | p. 97 |
Modeling a Threaded Forum with acts_as_nested_set | p. 100 |
Creating a Directory of Nested Topics with acts_as_tree | p. 104 |
Avoiding Race Conditions with Optimistic Locking | p. 107 |
Handling Tables with Legacy Naming Conventions | p. 109 |
Automating Record Timestamping | p. 111 |
Factoring Out Common Relationships with Polymorphic Associations | p. 112 |
Mixing Join Models and Polymorphism for Flexible Data Modeling | p. 115 |
Action Controller | p. 121 |
Accessing Form Data from a Controller | p. 122 |
Changing an Application's Default Page | p. 125 |
Clarifying Your Code with Named Routes | p. 126 |
Configuring Customized Routing Behavior | p. 127 |
Displaying Alert Messages with Flash | p. 129 |
Extending the Life of a Flash Message | p. 131 |
Following Actions with Redirects | p. 133 |
Generating URLs Dynamically | p. 134 |
Inspecting Requests with Filters | p. 135 |
Logging with Filters | p. 137 |
Rendering Actions | p. 140 |
Restricting Access to Controller Methods | p. 141 |
Sending Files or Data Streams to the Browser | p. 142 |
Storing Session Information in a Database | p. 144 |
Tracking Information with Sessions | p. 146 |
Using Filters for Authentication | p. 149 |
Action View | p. 155 |
Simplifying Templates with View Helpers | p. 156 |
Displaying Large Datasets with Pagination | p. 158 |
Creating a Sticky Select List | p. 161 |
Editing Many-to-Many Relationships with Multiselect Lists | p. 163 |
Factoring Out Common Display Code with Layouts | p. 166 |
Defining a Default Application Layout | p. 169 |
Generating XML with Builder Templates | p. 170 |
Generating RSS Feeds from Active Record Data | p. 172 |
Reusing Page Elements with Partials | p. 174 |
Processing Dynamically Created Input Fields | p. 177 |
Customizing the Behavior of Standard Helpers | p. 181 |
Creating a Web Form with Form Helpers | p. 183 |
Formatting Dates, Times, and Currencies | p. 187 |
Personalizing User Profiles with Gravatars | p. 190 |
Avoiding Harmful Code in Views with Liquid Templates | p. 191 |
Globalizing Your Rails Application | p. 195 |
Restful Development | p. 201 |
Creating Nested Resources | p. 204 |
Supporting Alternative Data Formats by MIME Type | p. 208 |
Modeling Relationships Restfully with Join Models | p. 210 |
Moving Beyond Simple CRUD with Restful Resources | p. 213 |
Consuming Complex Nested Rest Resources | p. 217 |
Developing Your Rails Applications Restfully | p. 220 |
Rails Application Testing | p. 225 |
Centralizing the Creation of Objects Common to Test Cases | p. 226 |
Creating Fixtures for Many-to-Many Associations | p. 227 |
Importing Test Data with CSV Fixtures | p. 229 |
Including Dynamic Data in Fixtures with ERb | p. 232 |
Initializing a Test Database | p. 233 |
Interactively Testing Controllers from the Rails Console | p. 235 |
Interpreting the Output of Test::Unit | p. 237 |
Loading Test Data with YAML Fixtures | p. 238 |
Monitoring Test Coverage with rake stats | p. 240 |
Running Tests with Rake | p. 241 |
Speeding Up Tests with Transactional Fixtures | p. 242 |
Testing Across Controllers with Integration Tests | p. 244 |
Testing Controllers with Functional Tests | p. 247 |
Examining the Contents of Cookie | p. 250 |
Testing Custom and Named Routes | p. 253 |
Testing HTTP Requests with Response-Related Assertions | p. 255 |
Testing a Model with Unit Tests | p. 256 |
Unit Testing Model Validations | p. 259 |
Verifying DOM Structure with Tag-Related Assertions | p. 261 |
Writing Custom Assertions | p. 264 |
Testing File Upload | p. 265 |
Modifying the Default Behavior of a Class for Testing by Using Mocks | p. 269 |
Improving Feedback by Running Tests Continuously | p. 271 |
Analyzing Code Coverage with Rcov | p. 272 |
JavaScript and Ajax | p. 277 |
Adding DOM Elements to a Page | p. 278 |
Creating a Custom Report with Drag and Drop | p. 281 |
Dynamically Adding Items to a Select List | p. 286 |
Monitoring the Content Length of a Textarea | p. 288 |
Updating Page Elements with RJS Templates | p. 292 |
Inserting JavaScript into Templates | p. 295 |
Letting a User Reorder a List | p. 298 |
Autocompleting a Text Field | p. 302 |
Searching for and Highlighting Text Dynamically | p. 304 |
Enhancing the User Interface with Visual Effects | p. 308 |
Implementing a Live Search | p. 311 |
Editing Fields in Place | p. 315 |
Creatingan Ajax Progress Indicator | p. 317 |
Action Mailer | p. 321 |
Configuring Rails to Send Email | p. 322 |
Creating a Custom Mailer Class with the Mailer Generator | p. 323 |
Formatting Email Messages Using Templates | p. 325 |
Attaching Files to Email Messages | p. 326 |
Sending Email from a Rails Application | p. 327 |
Receiving Email with Action Mailer | p. 328 |
Debugging Rails Applications | p. 333 |
Exploring Rails from the Console | p. 334 |
Fixing Bugs at the Source with Ruby -cw | p. 336 |
Debugging Your Application in Real Time with the breakpointer | p. 338 |
Logging with the Built-in Rails Logger Class | p. 342 |
Writing Debugging Information to a File | p. 344 |
Emailing Application Exceptions | p. 346 |
Outputting Environment Information in Views | p. 350 |
Displaying Object Contents with Exceptions | p. 352 |
Filtering Development Logs in Real Time | p. 353 |
Debugging HTTP Communication with Firefox Extensions | p. 355 |
Debugging Your JavaScript in Real Time with the JavaScript Shell | p. 356 |
Debugging Your Code Interactively with ruby-debug | p. 360 |
Security | p. 365 |
Hardening Your Systems with Strong Passwords | p. 365 |
Protecting Queries from SQL Injection | p. 368 |
Guarding Against Cross-Site Scripting Attacks | p. 369 |
Restricting Access to Public Methods or Actions | p. 371 |
Securing Your Server by Closing Unnecessary Ports | p. 373 |
Performance | p. 377 |
Measuring Web Server Performance with Httperf | p. 378 |
Benchmarking Portions of Your Application Code | p. 381 |
Improving Performance by Caching Static Pages | p. 382 |
Expiring Cached Pages | p. 385 |
Mixing Static and Dynamic Content with Fragment Caching | p. 388 |
Filtering Cached Pages with Action Caching | p. 391 |
Speeding Up Data Access Times with memcached | p. 392 |
Increasing Performance by Caching Post-Processed Content | p. 395 |
Hosting and Deployment | p. 399 |
Hosting Rails Using Apache 1.3 and mod_fastcgi | p. 400 |
Managing Multiple Mongrel Processes with mongrel_cluster | p. 402 |
Hosting Rails with Apache 2.2, mod_proxy_balancer, and Mongrel | p. 405 |
Deploying Rails with Pound in Front of Mongrel, Lighttpd, and Apache | p. 409 |
Customizing Pound's Logging with cronolog | p. 413 |
Configuring Pound with SSL Support | p. 416 |
Simple Load Balancing with Pen | p. 418 |
Deploying Your Rails Project with Capistrano | p. 419 |
Deploying Your Application to Multiple Environments with Capistrano | p. 423 |
Deploying with Capistrano When You Can't Access Subversion | p. 425 |
Deploying with Capistrano and mongrel_cluster | p. 427 |
Disabling Your Web Site During Maintenance | p. 429 |
Writing Custom Capistrano Tasks | p. 432 |
Cleaning Up Residual Session Records | p. 436 |
Extending Rails with Plug-ins | p. 439 |
Finding Third-Party Plug-ins | p. 440 |
Installing Plug-ins | p. 441 |
Manipulating Record Versions with acts_as_versioned | p. 443 |
Building Authentication with acts_as_authenticated | p. 446 |
Simplifying Folksonomy with the acts_as_taggable | p. 450 |
Extending Active Record with acts_as | p. 455 |
Adding View Helpers to Rails as Plug-ins | p. 460 |
Uploading Files with file_column | p. 462 |
Uploading Files with acts_as_attachment | p. 465 |
Disabling Records Instead of Deleting Them with acts_as_paranoid | p. 469 |
Adding More Elaborate Authentication Using the Login Engine | p. 471 |
Graphics | p. 475 |
Installing RMagick for Image Processing | p. 475 |
Uploading Images to a Database | p. 480 |
Serving Images Directly from a Database | p. 484 |
Creating Resized Thumbnails with RMagick | p. 485 |
Generating PDF Documents | p. 488 |
Visually Displaying Data with Gruff | p. 490 |
Creating Small, Informative Graphs with Sparklines | p. 493 |
Migrating to Rails 1.2 | p. 497 |
Index | p. 501 |
Table of Contents provided by Ingram. All Rights Reserved. |
The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.
The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.
Digital License
You are licensing a digital product for a set duration. Durations are set forth in the product description, with "Lifetime" typically meaning five (5) years of online access and permanent download to a supported device. All licenses are non-transferable.
More details can be found here.