Partial commit 3 for the Rails 4 migration. Fixing a few tests #740