Updated to suport newer versions of rails