Rails4 compatibility

This will work only with Rails4.