| | Copyright |
| | Foreword |
| | Preface |
| | Chapter 1. Getting Started |
| | | Section 1.0. Introduction |
| | | Recipe 1.1. Joining the Rails Community |
| | | Recipe 1.2. Finding Documentation |
| | | Recipe 1.3. Installing MySQL |
| | | Recipe 1.4. Installing PostgreSQL |
| | | Recipe 1.5. Installing Rails |
| | | Recipe 1.6. Fixing Ruby and Installing Rails on OS X 10.4 Tiger |
| | | Recipe 1.7. Running Rails in OS X with Locomotive |
| | | Recipe 1.8. Running Rails in Windows with Instant Rails |
| | | Recipe 1.9. Updating Rails with RubyGems |
| | | Recipe 1.10. Getting Your Rails Project into Subversion |
| | Chapter 2. Rails Development |
| | | Section 2.0. Introduction |
| | | Recipe 2.1. Creating a Rails Project |
| | | Recipe 2.2. Jump-Starting Development with Scaffolding |
| | | Recipe 2.3. Speeding Up Rails Development with Mongrel |
| | | Recipe 2.4. Enhancing Windows Development with Cygwin |
| | | Recipe 2.5. Understanding Pluralization Patterns in Rails |
| | | Recipe 2.6. Developing Rails in OS X with TextMate |
| | | Recipe 2.7. Cross-Platform Developing with RadRails |
| | | Recipe 2.8. Installing and Running Edge Rails |
| | | Recipe 2.9. Setting Up Passwordless Authentication with SSH |
| | | Recipe 2.10. Generating RDoc for Your Rails Application |
| | | Recipe 2.11. Creating Full-Featured CRUD Applications with Streamlined |
| | Chapter 3. Active Record |
| | | Section 3.0. Introduction |
| | | Recipe 3.1. Setting Up a Relational Database to Use with Rails |
| | | Recipe 3.2. Programmatically Defining Database Schema |
| | | Recipe 3.3. Developing Your Database with Migrations |
| | | Recipe 3.4. Modeling a Database with Active Record |
| | | Recipe 3.5. Inspecting Model Relationships from the Rails Console |
| | | Recipe 3.6. Accessing Your Data via Active Record |
| | | Recipe 3.7. Retrieving Records with find |
| | | Recipe 3.8. Iterating Over an Active Record Result Set |
| | | Recipe 3.9. Retrieving Data Efficiently with Eager Loading |
| | | Recipe 3.10. Updating an Active Record Object |
| | | Recipe 3.11. Enforcing Data Integrity with Active Record Validations |
| | | Recipe 3.12. Executing Custom Queries with find_by_sql |
| | | Recipe 3.13. Protecting Against Race Conditions with Transactions |
| | | Recipe 3.14. Adding Sort Capabilities to a Model with acts_as_list |
| | | Recipe 3.15. Performing a Task Whenever a Model Object Is Created |
| | | Recipe 3.16. Modeling a Threaded Forum with acts_as_nested_set |
| | | Recipe 3.17. Creating a Directory of Nested Topics with acts_as_tree |
| | | Recipe 3.18. Avoiding Race Conditions with Optimistic Locking |
| | | Recipe 3.19. Handling Tables with Legacy Naming Conventions |
| | | Recipe 3.20. Automating Record Timestamping |
| | | Recipe 3.21. Factoring Out Common Relationships with Polymorphic Associations |
| | | Recipe 3.22. Mixing Join Models and Polymorphism for Flexible Data Modeling |
| | Chapter 4. Action Controller |
| | | Section 4.0. Introduction |
| | | Recipe 4.1. Accessing Form Data from a Controller |
| | | Recipe 4.2. Changing an Application's Default Page |
| | | Recipe 4.3. Clarifying Your Code with Named Routes |
| | | Recipe 4.4. Configuring Customized Routing Behavior |
| | | Recipe 4.5. Displaying Alert Messages with Flash |
| | | Recipe 4.6. Extending the Life of a Flash Message |
| | | Recipe 4.7. Following Actions with Redirects |
| | | Recipe 4.8. Generating URLs Dynamically |
| | | Recipe 4.9. Inspecting Requests with Filters |
| | | Recipe 4.10. Logging with Filters |
| | | Recipe 4.11. Rendering Actions |
| | | Recipe 4.12. Restricting Access to Controller Methods |
| | | Recipe 4.13. Sending Files or Data Streams to the Browser |
| | | Recipe 4.14. Storing Session Information in a Database |
| | | Recipe 4.15. Tracking Information with Sessions |
| | | Recipe 4.16. Using Filters for Authentication |
| | Chapter 5. Action View |
| | | Section 5.0. Introduction |
| | | Recipe 5.1. Simplifying Templates with View Helpers |
| | | Recipe 5.2. Displaying Large Datasets with Pagination |
| | | Recipe 5.3. Creating a Sticky Select List |
| | | Recipe 5.4. Editing Many-to-Many Relationships with Multiselect Lists |
| | | Recipe 5.5. Factoring Out Common Display Code with Layouts |
| | | Recipe 5.6. Defining a Default Application Layout |
| | | Recipe 5.7. Generating XML with Builder Templates |
| | | Recipe 5.8. Generating RSS Feeds from Active Record Data |
| | | Recipe 5.9. Reusing Page Elements with Partials |
| | | Recipe 5.10. Processing Dynamically Created Input Fields |
| | | Recipe 5.11. Customizing the Behavior of Standard Helpers |
| | | Recipe 5.12. Creating a Web Form with Form Helpers |
| | | Recipe 5.13. Formatting Dates, Times, and Currencies |
| | | Recipe 5.14. Personalizing User Profiles with Gravatars |
| | | Recipe 5.15. Avoiding Harmful Code in Views with Liquid Templates |
| | | Recipe 5.16. Globalizing Your Rails Application |
| | Chapter 6. RESTful Development |
| | | Section 6.0. Introduction |
| | | Recipe 6.1. Creating Nested Resources |
| | | Recipe 6.2. Supporting Alternative Data Formats by MIME Type |
| | | Recipe 6.3. Modeling Relationships RESTfully with Join Models |
| | | Recipe 6.4. Moving Beyond Simple CRUD with RESTful Resources |
| | | Recipe 6.5. Consuming Complex Nested REST Resources |
| | | Recipe 6.6. Developing Your Rails Applications RESTfully |
| | Chapter 7. Rails Application Testing |
| | | Section 7.0. Introduction |
| | | Recipe 7.1. Centralizing the Creation of Objects Common to Test Cases |
| | | Recipe 7.2. Creating Fixtures for Many-to-Many Associations |
| | | Recipe 7.3. Importing Test Data with CSV Fixtures |
| | | Recipe 7.4. Including Dynamic Data in Fixtures with ERb |
| | | Recipe 7.5. Initializing a Test Database |
| | | Recipe 7.6. Interactively Testing Controllers from the Rails Console |
| | | Recipe 7.7. Interpreting the Output of Test::Unit |
| | | Recipe 7.8. Loading Test Data with YAML Fixtures |
| | | Recipe 7.9. Monitoring Test Coverage with rake stats |
| | | Recipe 7.10. Running Tests with Rake |
| | | Recipe 7.11. Speeding Up Tests with Transactional Fixtures |
| | | Recipe 7.12. Testing Across Controllers with Integration Tests |
| | | Recipe 7.13. Testing Controllers with Functional Tests |
| | | Recipe 7.14. Examining the Contents of Cookie |
| | | Recipe 7.15. Testing Custom and Named Routes |
| | | Recipe 7.16. Testing HTTP Requests with Response-Related Assertions |
| | | Recipe 7.17. Testing a Model with Unit Tests |
| | | Recipe 7.18. Unit Testing Model Validations |
| | | Recipe 7.19. Verifying DOM Structure with Tag-Related Assertions |
| | | Recipe 7.20. Writing Custom Assertions |
| | | Recipe 7.21. Testing File Upload |
| | | Recipe 7.22. Modifying the Default Behavior of a Class for Testing by Using Mocks |
| | | Recipe 7.23. Improving Feedback by Running Tests Continuously |
| | | Recipe 7.24. Analyzing Code Coverage with Rcov |
| | Chapter 8. JavaScript and Ajax |
| | | Section 8.0. Introduction |
| | | Recipe 8.1. Adding DOM Elements to a Page |
| | | Recipe 8.2. Creating a Custom Report with Drag and Drop |
| | | Recipe 8.3. Dynamically Adding Items to a Select List |
| | | Recipe 8.4. Monitoring the Content Length of a Textarea |
| | | Recipe 8.5. Updating Page Elements with RJS Templates |
| | | Recipe 8.6. Inserting JavaScript into Templates |
| | | Recipe 8.7. Letting a User Reorder a List |
| | | Recipe 8.8. Autocompleting a Text Field |
| | | Recipe 8.9. Searching for and Highlighting Text Dynamically |
| | | Recipe 8.10. Enhancing the User Interface with Visual Effects |
| | | Recipe 8.11. Implementing a Live Search |
| | | Recipe 8.12. Editing Fields in Place |
| | | Recipe 8.13. Creating an Ajax Progress Indicator |
| | Chapter 9. Action Mailer |
| | | Section 9.0. Introduction |
| | | Recipe 9.1. Configuring Rails to Send Email |
| | | Recipe 9.2. Creating a Custom Mailer Class with the Mailer Generator |
| | | Recipe 9.3. Formatting Email Messages Using Templates |
| | | Recipe 9.4. Attaching Files to Email Messages |
| | | Recipe 9.5. Sending Email from a Rails Application |
| | | Recipe 9.6. Receiving Email with Action Mailer |
| | Chapter 10. Debugging Rails Applications |
| | | Section 10.0. Introduction |
| | | Recipe 10.1. Exploring Rails from the Console |
| | | Recipe 10.2. Fixing Bugs at the Source with Ruby -cw |
| | | Recipe 10.3. Debugging Your Application in Real Time with the breakpointer |
| | | Recipe 10.4. Logging with the Built-in Rails Logger Class |
| | | Recipe 10.5. Writing Debugging Information to a File |
| | | Recipe 10.6. Emailing Application Exceptions |
| | | Recipe 10.7. Outputting Environment Information in Views |
| | | Recipe 10.8. Displaying Object Contents with Exceptions |
| | | Recipe 10.9. Filtering Development Logs in Real Time |
| | | Recipe 10.10. Debugging HTTP Communication with Firefox Extensions |
| | | Recipe 10.11. Debugging Your JavaScript in Real Time with the JavaScript Shell |
| | | Recipe 10.12. Debugging Your Code Interactively with ruby-debug |
| | Chapter 11. Security |
| | | Section 11.0. Introduction |
| | | Recipe 11.1. Hardening Your Systems with Strong Passwords |
| | | Recipe 11.2. Protecting Queries from SQL Injection |
| | | Recipe 11.3. Guarding Against Cross-Site Scripting Attacks |
| | | Recipe 11.4. Restricting Access to Public Methods or Actions |
| | | Recipe 11.5. Securing Your Server by Closing Unnecessary Ports |
| | Chapter 12. Performance |
| | | Section 12.0. Introduction |
| | | Recipe 12.1. Measuring Web Server Performance with Httperf |
| | | Recipe 12.2. Benchmarking Portions of Your Application Code |
| | | Recipe 12.3. Improving Performance by Caching Static Pages |
| | | Recipe 12.4. Expiring Cached Pages |
| | | Recipe 12.5. Mixing Static and Dynamic Content with Fragment Caching |
| | | Recipe 12.6. Filtering Cached Pages with Action Caching |
| | | Recipe 12.7. Speeding Up Data Access Times with memcached |
| | | Recipe 12.8. Increasing Performance by Caching Post-Processed Content |
| | Chapter 13. Hosting and Deployment |
| | | Section 13.0. Introduction |
| | | Recipe 13.1. Hosting Rails Using Apache 1.3 and mod_fastcgi |
| | | Recipe 13.2. Managing Multiple Mongrel Processes with mongrel_cluster |
| | | Recipe 13.3. Hosting Rails with Apache 2.2, mod_proxy_balancer, and Mongrel |
| | | Recipe 13.4. Deploying Rails with Pound in Front of Mongrel, Lighttpd, and Apache |
| | | Recipe 13.5. Customizing Pound's Logging with cronolog |
| | | Recipe 13.6. Configuring Pound with SSL Support |
| | | Recipe 13.7. Simple Load Balancing with Pen |
| | | Recipe 13.8. Deploying Your Rails Project with Capistrano |
| | | Recipe 13.9. Deploying Your Application to Multiple Environments with Capistrano |
| | | Recipe 13.10. Deploying with Capistrano When You Can't Access Subversion |
| | | Recipe 13.11. Deploying with Capistrano and mongrel_cluster |
| | | Recipe 13.12. Disabling Your Web Site During Maintenance |
| | | Recipe 13.13. Writing Custom Capistrano Tasks |
| | | Recipe 13.14. Cleaning Up Residual Session Records |
| | Chapter 14. Extending Rails with Plug-ins |
| | | Section 14.0. Introduction |
| | | Recipe 14.1. Finding Third-Party Plug-ins |
| | | Recipe 14.2. Installing Plug-ins |
| | | Recipe 14.3. Manipulating Record Versions with acts_as_versioned |
| | | Recipe 14.4. Building Authentication with acts_as_authenticated |
| | | Recipe 14.5. Simplifying Folksonomy with the acts_as_taggable |
| | | Recipe 14.6. Extending Active Record with acts_as |
| | | Recipe 14.7. Adding View Helpers to Rails as Plug-ins |
| | | Recipe 14.8. Uploading Files with file_column |
| | | Recipe 14.9. Uploading Files with acts_as_attachment |
| | | Recipe 14.10. Disabling Records Instead of Deleting Them with acts_as_paranoid |
| | | Recipe 14.11. Adding More Elaborate Authentication Using the Login Engine |
| | Chapter 15. Graphics |
| | | Section 15.0. Introduction |
| | | Recipe 15.1. Installing RMagick for Image Processing |
| | | Recipe 15.2. Uploading Images to a Database |
| | | Recipe 15.3. Serving Images Directly from a Database |
| | | Recipe 15.4. Creating Resized Thumbnails with RMagick |
| | | Recipe 15.5. Generating PDF Documents |
| | | Recipe 15.6. Visually Displaying Data with Gruff |
| | | Recipe 15.7. Creating Small, Informative Graphs with Sparklines |
| | Appendix A. Migrating to Rails 1.2 |
| | | Action Controller |
| | | Active Record |
| | | Action View |
| | Colophon |
| | Index |