Upgrade rails

Really the work of yesteday's  work. Somebody fancy checking?