Browse Source

We don't need a getter for old_user_id on User

pull/894/head
James Rose 3 years ago
parent
commit
e54b9d0d59
  1. 6
      app/models/user.rb
  2. 2
      db/schema.rb
  3. 6
      spec/models/user_spec.rb

6
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

2
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"

6
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

Loading…
Cancel
Save