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