Overview

Rails Cookbook is packed with the solutions you need to be a proficient developer with Rails, the leading framework for building the new generation of Web 2.0 applications. Recipes range from the basics, like installing Rails and setting up your development environment, to the latest techniques, such as developing RESTful web services.

With applications that are code light, feature-full and built to scale quickly, Rails has revolutionized web ...

See more details below
Rails Cookbook

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK
  • NOOK HD/HD+ Tablet
  • NOOK
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$17.99
BN.com price
(Save 43%)$31.99 List Price

Overview

Rails Cookbook is packed with the solutions you need to be a proficient developer with Rails, the leading framework for building the new generation of Web 2.0 applications. Recipes range from the basics, like installing Rails and setting up your development environment, to the latest techniques, such as developing RESTful web services.

With applications that are code light, feature-full and built to scale quickly, Rails has revolutionized web development. The Rails Cookbook addresses scores of real-world challenges; each one includes a tested solution, plus a discussion of how and why it works, so that you can adapt the techniques to similar situations. Topics include:

  • Modeling data with the ActiveRecord library
  • Setting up views with ActionView and RHTML templates
  • Building your application's logic into ActionController
  • Testing and debugging your Rails application
  • Building responsive web applications using JavaScript and Ajax
  • Ensuring that your application is security and performs well
  • Deploying your application with Mongrel and Apache
  • Using Capistrano to automate deployment
  • Using the many Rails plugins
  • Working with graphics


Whether you're new to Rails or an experienced developer, you'll discover ways to test, debug and secure your applications, incorporate Ajax, use caching to improve performance, and put your application into production. Want to get ahead of the Web 2.0 curve? This valuable cookbook will save you hundreds of hours when developing applications with Rails.

Rails is one of the leading frameworks for developing the new generation of Web 2.0 applications using the increasingly popular Ruby scripting language. This title is for all web developers, regardless of experience, who want to learn about the fastest growing web application framework on the market.

Read More Show Less

Product Details

  • ISBN-13: 9780596554644
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 1/16/2007
  • Series: Cookbooks (O'Reilly)
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 1
  • Pages: 544
  • Sales rank: 1,235,082
  • File size: 6 MB

Meet the Author

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.

Read More Show Less

Table of Contents


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

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)