1
0
Fork 0

Add method ImportPerson#create_general_comments_person_comment

This commit is contained in:
Alex Kotov 2019-07-26 03:18:10 +05:00
parent 2da00940a1
commit 1a386949c0
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08

View file

@ -6,6 +6,7 @@ class ImportPerson
def call
ActiveRecord::Base.transaction do
create_person
create_general_comments_person_comment
end
end
@ -20,6 +21,18 @@ private
)
end
def create_general_comments_person_comment
return if context.general_comments.blank?
context.general_comments_person_comment =
context.person.person_comments.where(origin: :general_comments)
.lock(true).first_or_initialize
context.general_comments_person_comment.text = context.general_comments
context.general_comments_person_comment.save!
end
def person_attributes
{
last_name: context.last_name,