Fix rails 4 compatibility