Archive for the ‘Tips’ Category

New Edge Rails Feature: Default Scoping

In his "What's New in Edge Rails" series, Ryan Daigle has just written about "default scoping." You're probably familiar with regular named scopes on Rails models, but now there's a default_scope method that defines a scope that exists by default on find methods.
Example:
class Article 'created_at DESC'
end
The default scope also carries across, by default, to [...]

Page Caching Enhancements

For anyone who's struggled at how to obtain the maximum performance in a Rails application on limited hardware- the good guys over at Rails Spikes have posted an informative article with some tips on implementing page caching in a Rails application while still maintaining some flexibility.
They include tips such as using the Cacheable Flash plugin, [...]

How to Detect and Fix Slow Rails Requests

August 2nd, 2008 in Miscellaneous, Tips

Derek Haynes has written "4 Simple Steps to Detect & Fix Slow Rails Requests," an excellent guide to figuring out what's causing your Rails app to slow down, and what to do about it. The main argument is that Rails itself is not usually to blame, but instead ancillary things like database access, CPU load, [...]

Rails 2.1 Caching Walkthrough

Rob Anderton has put together an easy-to-read walkthrough of some of the new caching features in Rails 2.1. One of the coolest new features is that Rails provides an abstraction to using the back-end caching features (whether ultimately provided by file stores or memcached):
# Write a string to the cache
Rails.cache.write('test_key', 'test_value')
=> true

# Read it back [...]