Fix AccountNote not having a maximum length (#16942)
This commit is contained in:
parent
39cdf61ab7
commit
87085a5152
4 changed files with 86 additions and 12 deletions
|
@ -53,10 +53,16 @@ class MoveWorker
|
|||
|
||||
new_note = AccountNote.find_by(account: note.account, target_account: @target_account)
|
||||
if new_note.nil?
|
||||
AccountNote.create!(account: note.account, target_account: @target_account, comment: [text, note.comment].join("\n"))
|
||||
begin
|
||||
AccountNote.create!(account: note.account, target_account: @target_account, comment: [text, note.comment].join("\n"))
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
AccountNote.create!(account: note.account, target_account: @target_account, comment: note.comment)
|
||||
end
|
||||
else
|
||||
new_note.update!(comment: [text, note.comment, "\n", new_note.comment].join("\n"))
|
||||
end
|
||||
rescue ActiveRecord::RecordInvalid
|
||||
nil
|
||||
rescue => e
|
||||
@deferred_error = e
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue