Find related contacts via ident and ident_country_code

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

View file

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