Living on the Edge (of Rails) – 1st week of the year edition

In: Edge Rails|Open Source|Personal|Ruby|Ruby on Rails

9 Jan 2008

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

1 Response to Living on the Edge (of Rails) – 1st week of the year edition

Avatar

Robert Dempsey

January 11th, 2008 at 1am

Your readers might be interested to know that they can meet the Rails Envy guys in person at acts_as_conference here in Orlando, FL February 8th ant 9th (actsasconference.com). Gregg and Jason will be there, and so should everyone else ;). Thanks for keeping us up with the latest Rails goodness.