diff --git a/app/models/user.rb b/app/models/user.rb index 50db816e7..40a430489 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -113,12 +113,8 @@ class User < ApplicationRecord end end - def old_user_id - legacy_users&.first&.old_user_id || read_attribute(:old_user_id) - end - def was_migrated_from_softwire? - old_user_id.present? + legacy_users.any? || old_user_id.present? end def send_confirmation_instructions diff --git a/db/schema.rb b/db/schema.rb index 0af743586..a0f222232 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -332,8 +332,8 @@ ActiveRecord::Schema[7.0].define(version: 2022_09_23_093628) do t.string "purchid" t.integer "type" t.integer "ownershipsch" - t.integer "jointpur" t.string "othtype" + t.integer "jointpur" t.index ["created_by_id"], name: "index_sales_logs_on_created_by_id" t.index ["managing_organisation_id"], name: "index_sales_logs_on_managing_organisation_id" t.index ["owning_organisation_id"], name: "index_sales_logs_on_owning_organisation_id" diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index bad70e31e..450e334a7 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -75,11 +75,7 @@ RSpec.describe User, type: :model do end it "can have one or more legacy users" do - expect(user.old_user_id).to eq("3") - - user.legacy_users.destroy_all - user.update!(old_user_id: "2") - expect(user.old_user_id).to eq("2") + expect(user.legacy_users.size).to eq(1) end it "is confirmable" do