Class: Renalware::Letters::Printing::CompleteBatch
- Inherits:
-
Object
- Object
- Renalware::Letters::Printing::CompleteBatch
- Defined in:
- app/models/renalware/letters/printing/complete_batch.rb
Overview
Marks as completed a Batch and all Letters within it.
Instance Method Summary collapse
-
#call ⇒ Object
TOD: Avoid loading all letters into memory.
Instance Method Details
#call ⇒ Object
TOD: Avoid loading all letters into memory
13 14 15 16 17 18 19 |
# File 'app/models/renalware/letters/printing/complete_batch.rb', line 13 def call Batch.transaction do batch.letters.each { |letter| CompleteLetter.build(letter).call(by: user) } batch.update_by(user, status: :success) batch.reload end end |