Altered to match rails 2.3.2 implementation.