Yup, it's time for your weekly dose of the changes on edge Rails, more or less covered in the latest Rails Envy podcast. Using edge Rails is neither arcane nor terrifying, and hopefully weekly reports like these will allow you to take control of your own release schedule with your Rails apps.

This week's report covers changes from 31 Dec 2007 to the day the podcast was recorded (6 Jan 2007).

Caching changes

Looks like most of the changes from the 2.1 caching branch have been
merged into the trunk. Some key points:

  1. memcache-client has been vendored (included in Rails directly). MemCacheStore works out of the box in Rails now, no need to install the memcache-client gem!
  2. The caching code has been refactored and moved into ActiveSupport (ActiveSupport::Cache::*).
  3. Added ActiveRecord::Base.cache_key to make it easier to cache Active Records in combination with the ActiveSupport cache libraries introduced in this changeset.
  4. Fragment cache keys are now by default prefixed with 'views/'.
  5. Deprecation: ActionController::Base.fragment_cache_store is now ActionController::Base.cache_store

Fragment caching now works in RJS and Builder templates

Yup, you couldn't do fragment caching in non-erb views before - now you can.

Freezing Rails now automatically updates your Rails app

If you're using edge Rails and use the rails:freeze:edge rake task, you probably usually forget to run (or maybe you're not even aware of) rake rails:update to update your Rails app with the latest config/, scripts/ and javascript files from the version of Rails you just froze to. On edge Rails, the rake rails:freeze:edge task runs the rails:update task for you. +1 for convenience!

I prefer to use Piston so I'm gonna have to keep remembering to run my rake rails:update now and then!

Check out the related changeset.

Optimizations

Only 1 optimization in the past week worth talking about: the ActiveRecord::Base#exists? method is faster. It now uses ActiveRecord::Base#select_all instead of a more expensive ActiveRecord::Base#find that unnecessarily instantiates AR objects. (Check out the related changeset.)

Bug fixes