Make it compatible with rails 4