10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/mailers/bulk_csv_parser/import_mailer.rb', line 10
def result_email(to:, model:, result:)
@model = model
@result = result
limit = BulkCsvParser.configuration.notify_error_limit
@errors = result.errors.first(limit)
@more_errors_count = [result.errors.size - @errors.size, 0].max
status = result.success? ? "succeeded" : "completed with errors"
mail(
to: to,
subject: "CSV import for #{@model} #{status}: " \
"#{result.success_count} succeeded, #{result.failed_count} failed"
)
end
|