Try to backport to rails 2.3 (Try 1)