Partial commit 4 for the Rails 4 migration. Fixing a few tests and removing all the deprecation warnings #740