| |
| |
Foreword | |
| |
| |
Preface | |
| |
| |
| |
Getting Started | |
| |
| |
| |
Joining the Rails Community | |
| |
| |
| |
Finding Documentation | |
| |
| |
| |
Installing MySQL | |
| |
| |
| |
Installing PostgreSQL | |
| |
| |
| |
Installing Rails | |
| |
| |
| |
Fixing Ruby and Installing Rails on OS X 10.4 Tiger | |
| |
| |
| |
Running Rails in OS X with Locomotive | |
| |
| |
| |
Running Rails in Windows with Instant Rails | |
| |
| |
| |
Updating Rails with RubyGems | |
| |
| |
| |
Getting Your Rails Project into Subversion | |
| |
| |
| |
Rails Development | |
| |
| |
| |
Creating a Rails Project | |
| |
| |
| |
Jump-Starting Development with Scaffolding | |
| |
| |
| |
Speeding Up Rails Development with Mongrel | |
| |
| |
| |
Enhancing Windows Development with Cygwin | |
| |
| |
| |
Understanding Pluralization Patterns in Rails | |
| |
| |
| |
Developing Rails in OS X with TextMate | |
| |
| |
| |
Cross-Platform Developing with RadRails | |
| |
| |
| |
Installing and Running Edge Rails | |
| |
| |
| |
Setting Up Passwordless Authentication with SSH | |
| |
| |
| |
Generating RDoc for Your Rails Application | |
| |
| |
| |
Creating Full-Featured CRUD Applications with Streamlined | |
| |
| |
| |
Active Record | |
| |
| |
| |
Setting Up a Relational Database to Use with Rails | |
| |
| |
| |
Programmatically Defining Database Schema | |
| |
| |
| |
Developing Your Database with Migrations | |
| |
| |
| |
Modeling a Database with Active Record | |
| |
| |
| |
Inspecting Model Relationships from the Rails Console | |
| |
| |
| |
Accessing Your Data via Active Record | |
| |
| |
| |
Retrieving Records with find | |
| |
| |
| |
Iterating Over an Active Record Result Set | |
| |
| |
| |
Retrieving Data Efficiently with Eager Loading | |
| |
| |
| |
Updating an Active Record Object | |
| |
| |
| |
Enforcing Data Integrity with Active Record Validations | |
| |
| |
| |
Executing Custom Queries with find_by_sql | |
| |
| |
| |
Protecting Against Race Conditions with Transactions | |
| |
| |
| |
Adding Sort Capabilities to a Model with acts_as_list | |
| |
| |
| |
Performing a Task Whenever a Model Object Is Created | |
| |
| |
| |
Modeling a Threaded Forum with acts_as_nested_set | |
| |
| |
| |
Creating a Directory of Nested Topics with acts_as_tree | |
| |
| |
| |
Avoiding Race Conditions with Optimistic Locking | |
| |
| |
| |
Handling Tables with Legacy Naming Conventions | |
| |
| |
| |
Automating Record Timestamping | |
| |
| |
| |
Factoring Out Common Relationships with Polymorphic Associations | |
| |
| |
| |
Mixing Join Models and Polymorphism for Flexible Data Modeling | |
| |
| |
| |
Action Controller | |
| |
| |
| |
Accessing Form Data from a Controller | |
| |
| |
| |
Changing an Application's Default Page | |
| |
| |
| |
Clarifying Your Code with Named Routes | |
| |
| |
| |
Configuring Customized Routing Behavior | |
| |
| |
| |
Displaying Alert Messages with Flash | |
| |
| |
| |
Extending the Life of a Flash Message | |
| |
| |
| |
Following Actions with Redirects | |
| |
| |
| |
Generating URLs Dynamically | |
| |
| |
| |
Inspecting Requests with Filters | |
| |
| |
| |
Logging with Filters | |
| |
| |
| |
Rendering Actions | |
| |
| |
| |
Restricting Access to Controller Methods | |
| |
| |
| |
Sending Files or Data Streams to the Browser | |
| |
| |
| |
Storing Session Information in a Database | |
| |
| |
| |
Tracking Information with Sessions | |
| |
| |
| |
Using Filters for Authentication | |
| |
| |
| |
Action View | |
| |
| |
| |
Simplifying Templates with View Helpers | |
| |
| |
| |
Displaying Large Datasets with Pagination | |
| |
| |
| |
Creating a Sticky Select List | |
| |
| |
| |
Editing Many-to-Many Relationships with Multiselect Lists | |
| |
| |
| |
Factoring Out Common Display Code with Layouts | |
| |
| |
| |
Defining a Default Application Layout | |
| |
| |
| |
Generating XML with Builder Templates | |
| |
| |
| |
Generating RSS Feeds from Active Record Data | |
| |
| |
| |
Reusing Page Elements with Partials | |
| |
| |
| |
Processing Dynamically Created Input Fields | |
| |
| |
| |
Customizing the Behavior of Standard Helpers | |
| |
| |
| |
Creating a Web Form with Form Helpers | |
| |
| |
| |
Formatting Dates, Times, and Currencies | |
| |
| |
| |
Personalizing User Profiles with Gravatars | |
| |
| |
| |
Avoiding Harmful Code in Views with Liquid Templates | |
| |
| |
| |
Globalizing Your Rails Application | |
| |
| |
| |
Restful Development | |
| |
| |
| |
Creating Nested Resources | |
| |
| |
| |
Supporting Alternative Data Formats by MIME Type | |
| |
| |
| |
Modeling Relationships Restfully with Join Models | |
| |
| |
| |
Moving Beyond Simple CRUD with Restful Resources | |
| |
| |
| |
Consuming Complex Nested Rest Resources | |
| |
| |
| |
Developing Your Rails Applications Restfully | |
| |
| |
| |
Rails Application Testing | |
| |
| |
| |
Centralizing the Creation of Objects Common to Test Cases | |
| |
| |
| |
Creating Fixtures for Many-to-Many Associations | |
| |
| |
| |
Importing Test Data with CSV Fixtures | |
| |
| |
| |
Including Dynamic Data in Fixtures with ERb | |
| |
| |
| |
Initializing a Test Database | |
| |
| |
| |
Interactively Testing Controllers from the Rails Console | |
| |
| |
| |
Interpreting the Output of Test::Unit | |
| |
| |
| |
Loading Test Data with YAML Fixtures | |
| |
| |
| |
Monitoring Test Coverage with rake stats | |
| |
| |
| |
Running Tests with Rake | |
| |
| |
| |
Speeding Up Tests with Transactional Fixtures | |
| |
| |
| |
Testing Across Controllers with Integration Tests | |
| |
| |
| |
Testing Controllers with Functional Tests | |
| |
| |
| |
Examining the Contents of Cookie | |
| |
| |
| |
Testing Custom and Named Routes | |
| |
| |
| |
Testing HTTP Requests with Response-Related Assertions | |
| |
| |
| |
Testing a Model with Unit Tests | |
| |
| |
| |
Unit Testing Model Validations | |
| |
| |
| |
Verifying DOM Structure with Tag-Related Assertions | |
| |
| |
| |
Writing Custom Assertions | |
| |
| |
| |
Testing File Upload | |
| |
| |
| |
Modifying the Default Behavior of a Class for Testing by Using Mocks | |
| |
| |
| |
Improving Feedback by Running Tests Continuously | |
| |
| |
| |
Analyzing Code Coverage with Rcov | |
| |
| |
| |
JavaScript and Ajax | |
| |
| |
| |
Adding DOM Elements to a Page | |
| |
| |
| |
Creating a Custom Report with Drag and Drop | |
| |
| |
| |
Dynamically Adding Items to a Select List | |
| |
| |
| |
Monitoring the Content Length of a Textarea | |
| |
| |
| |
Updating Page Elements with RJS Templates | |
| |
| |
| |
Inserting JavaScript into Templates | |
| |
| |
| |
Letting a User Reorder a List | |
| |
| |
| |
Autocompleting a Text Field | |
| |
| |
| |
Searching for and Highlighting Text Dynamically | |
| |
| |
| |
Enhancing the User Interface with Visual Effects | |
| |
| |
| |
Implementing a Live Search | |
| |
| |
| |
Editing Fields in Place | |
| |
| |
| |
Creatingan Ajax Progress Indicator | |
| |
| |
| |
Action Mailer | |
| |
| |
| |
Configuring Rails to Send Email | |
| |
| |
| |
Creating a Custom Mailer Class with the Mailer Generator | |
| |
| |
| |
Formatting Email Messages Using Templates | |
| |
| |
| |
Attaching Files to Email Messages | |
| |
| |
| |
Sending Email from a Rails Application | |
| |
| |
| |
Receiving Email with Action Mailer | |
| |
| |
| |
Debugging Rails Applications | |
| |
| |
| |
Exploring Rails from the Console | |
| |
| |
| |
Fixing Bugs at the Source with Ruby -cw | |
| |
| |
| |
Debugging Your Application in Real Time with the breakpointer | |
| |
| |
| |
Logging with the Built-in Rails Logger Class | |
| |
| |
| |
Writing Debugging Information to a File | |
| |
| |
| |
Emailing Application Exceptions | |
| |
| |
| |
Outputting Environment Information in Views | |
| |
| |
| |
Displaying Object Contents with Exceptions | |
| |
| |
| |
Filtering Development Logs in Real Time | |
| |
| |
| |
Debugging HTTP Communication with Firefox Extensions | |
| |
| |
| |
Debugging Your JavaScript in Real Time with the JavaScript Shell | |
| |
| |
| |
Debugging Your Code Interactively with ruby-debug | |
| |
| |
| |
Security | |
| |
| |
| |
Hardening Your Systems with Strong Passwords | |
| |
| |
| |
Protecting Queries from SQL Injection | |
| |
| |
| |
Guarding Against Cross-Site Scripting Attacks | |
| |
| |
| |
Restricting Access to Public Methods or Actions | |
| |
| |
| |
Securing Your Server by Closing Unnecessary Ports | |
| |
| |
| |
Performance | |
| |
| |
| |
Measuring Web Server Performance with Httperf | |
| |
| |
| |
Benchmarking Portions of Your Application Code | |
| |
| |
| |
Improving Performance by Caching Static Pages | |
| |
| |
| |
Expiring Cached Pages | |
| |
| |
| |
Mixing Static and Dynamic Content with Fragment Caching | |
| |
| |
| |
Filtering Cached Pages with Action Caching | |
| |
| |
| |
Speeding Up Data Access Times with memcached | |
| |
| |
| |
Increasing Performance by Caching Post-Processed Content | |
| |
| |
| |
Hosting and Deployment | |
| |
| |
| |
Hosting Rails Using Apache 1.3 and mod_fastcgi | |
| |
| |
| |
Managing Multiple Mongrel Processes with mongrel_cluster | |
| |
| |
| |
Hosting Rails with Apache 2.2, mod_proxy_balancer, and Mongrel | |
| |
| |
| |
Deploying Rails with Pound in Front of Mongrel, Lighttpd, and Apache | |
| |
| |
| |
Customizing Pound's Logging with cronolog | |
| |
| |
| |
Configuring Pound with SSL Support | |
| |
| |
| |
Simple Load Balancing with Pen | |
| |
| |
| |
Deploying Your Rails Project with Capistrano | |
| |
| |
| |
Deploying Your Application to Multiple Environments with Capistrano | |
| |
| |
| |
Deploying with Capistrano When You Can't Access Subversion | |
| |
| |
| |
Deploying with Capistrano and mongrel_cluster | |
| |
| |
| |
Disabling Your Web Site During Maintenance | |
| |
| |
| |
Writing Custom Capistrano Tasks | |
| |
| |
| |
Cleaning Up Residual Session Records | |
| |
| |
| |
Extending Rails with Plug-ins | |
| |
| |
| |
Finding Third-Party Plug-ins | |
| |
| |
| |
Installing Plug-ins | |
| |
| |
| |
Manipulating Record Versions with acts_as_versioned | |
| |
| |
| |
Building Authentication with acts_as_authenticated | |
| |
| |
| |
Simplifying Folksonomy with the acts_as_taggable | |
| |
| |
| |
Extending Active Record with acts_as | |
| |
| |
| |
Adding View Helpers to Rails as Plug-ins | |
| |
| |
| |
Uploading Files with file_column | |
| |
| |
| |
Uploading Files with acts_as_attachment | |
| |
| |
| |
Disabling Records Instead of Deleting Them with acts_as_paranoid | |
| |
| |
| |
Adding More Elaborate Authentication Using the Login Engine | |
| |
| |
| |
Graphics | |
| |
| |
| |
Installing RMagick for Image Processing | |
| |
| |
| |
Uploading Images to a Database | |
| |
| |
| |
Serving Images Directly from a Database | |
| |
| |
| |
Creating Resized Thumbnails with RMagick | |
| |
| |
| |
Generating PDF Documents | |
| |
| |
| |
Visually Displaying Data with Gruff | |
| |
| |
| |
Creating Small, Informative Graphs with Sparklines | |
| |
| |
| |
Migrating to Rails 1.2 | |
| |
| |
Index | |