Add method ImportPerson#create_general_comments_person_comment
This commit is contained in:
parent
2da00940a1
commit
1a386949c0
1 changed files with 13 additions and 0 deletions
|
@ -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,
|
||||
|
|
Reference in a new issue