Fixed inverse_of issues

This commit is contained in:
Sergei Tsõganov 2022-03-21 11:50:00 +02:00 committed by Sergei Tsõganov
parent d50c3f0b45
commit 392e284463
2 changed files with 4 additions and 2 deletions

View file

@ -5,7 +5,7 @@ class Action < ApplicationRecord
belongs_to :contact, optional: true
has_many :subactions, class_name: 'Action',
foreign_key: 'bulk_action_id',
inverse_of: :action,
inverse_of: :bulk_action,
dependent: :destroy
belongs_to :bulk_action, class_name: 'Action', optional: true

View file

@ -110,6 +110,7 @@ class RegistrantUser < User
def last_name
username.split.second
end
# rubocop:disable Metrics/MethodLength
def update_related_contacts
grouped_contacts = Contact.where(ident: ident, ident_country_code: country.alpha2)
@ -126,7 +127,8 @@ class RegistrantUser < User
registrar.notify(bulk_action || action)
end
end
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/MethodLength
class << self
def find_or_create_by_api_data(user_data = {})
return false unless user_data[:ident]