remove useless columns from the db
This commit is contained in:
parent
8e1569a658
commit
71973de17c
2 changed files with 3 additions and 22 deletions
|
@ -57,26 +57,7 @@ class Avis < ApplicationRecord
|
||||||
attr_accessor :emails
|
attr_accessor :emails
|
||||||
attr_accessor :invite_linked_dossiers
|
attr_accessor :invite_linked_dossiers
|
||||||
|
|
||||||
def claimant
|
self.ignored_columns = [:instructeur_id, :tmp_expert_migrated]
|
||||||
claimant_id = read_attribute(:claimant_id)
|
|
||||||
claimant_type = read_attribute(:claimant_type)
|
|
||||||
if claimant_type == 'Instructeur' || !tmp_expert_migrated
|
|
||||||
Instructeur.find(claimant_id)
|
|
||||||
else
|
|
||||||
Expert.find(claimant_id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def claimant=(claimant)
|
|
||||||
self.claimant_id = claimant.id
|
|
||||||
|
|
||||||
if claimant.is_a? Instructeur
|
|
||||||
self.claimant_type = 'Instructeur'
|
|
||||||
else
|
|
||||||
self.claimant_type = 'Expert'
|
|
||||||
self.tmp_expert_migrated = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def email_to_display
|
def email_to_display
|
||||||
expert&.email
|
expert&.email
|
||||||
|
|
|
@ -123,7 +123,7 @@ ActiveRecord::Schema.define(version: 2021_03_11_141956) do
|
||||||
t.datetime "revoked_at"
|
t.datetime "revoked_at"
|
||||||
t.bigint "experts_procedure_id"
|
t.bigint "experts_procedure_id"
|
||||||
t.string "claimant_type"
|
t.string "claimant_type"
|
||||||
t.boolean "tmp_expert_migrated", default: false
|
t.boolean "tmp_expert_migrated"
|
||||||
t.index ["claimant_id"], name: "index_avis_on_claimant_id"
|
t.index ["claimant_id"], name: "index_avis_on_claimant_id"
|
||||||
t.index ["dossier_id"], name: "index_avis_on_dossier_id"
|
t.index ["dossier_id"], name: "index_avis_on_dossier_id"
|
||||||
t.index ["experts_procedure_id"], name: "index_avis_on_experts_procedure_id"
|
t.index ["experts_procedure_id"], name: "index_avis_on_experts_procedure_id"
|
||||||
|
|
Loading…
Add table
Reference in a new issue