Fixed for rails 4