Fix rails 3 compatibility