rails 4 fix by maxmcd