[refactor] Migrating to Rails 4.2 and foreign keys