diff --git a/lib/templates/process_document.rb b/lib/templates/process_document.rb index 9926f821..9326c224 100644 --- a/lib/templates/process_document.rb +++ b/lib/templates/process_document.rb @@ -45,7 +45,8 @@ module Templates ActiveStorage::Attachment.where(name: ATTACHMENT_NAME, record: attachment).destroy_all number_of_pages = HexaPDF::Document.new(io: StringIO.new(data)).pages.size - (attachment.metadata['pdf'] ||= {})[:number_of_pages] = number_of_pages + attachment.metadata['pdf'] ||= {} + attachment.metadata['pdf']['number_of_pages'] = number_of_pages attachment.save!