Fix rails 4-0-stable compatibility