Fix rails 3 errors