Use predefined methods to determine country and ident

This commit is contained in:
Karl Erik Õunapuu 2020-10-30 11:56:07 +02:00
parent 2f259982da
commit 89154c4fe2
No known key found for this signature in database
GPG key ID: C9DD647298A34764

View file

@ -55,8 +55,7 @@ class RegistrantUser < User
end
def update_related_contacts
cc, idcode = registrant_ident.split('-')
contacts = Contact.where(ident: idcode, ident_country_code: cc)
contacts = Contact.where(ident: ident, ident_country_code: country.alpha2)
.where('UPPER(name) != UPPER(?)', username)
contacts.each { |c| c.update(name: username) }