Rails upgrade fixes