get the biggest disk device name

Problem:
Hi guys. At the time i’m going to modify partition table for custom RedHat installation. In template I want to use ignoredisk “–only-use=” option and write a value from Foreman Facts gathered by FDI for purpose of selecting the largest disk to install OS. In Foreman GUI i’m able to view facts about hosts disks, their models , size, type , etc. . And faced with problem: how can i get the biggest disk device name, using ERB template? I found one suggestion to solve it

<% disk = disks.sort_by { |d| d[:size_bytes] }.last %>
<%= disk[:device] %>

but it doesn’t work. I’d appreciate any help.

Expected outcome:
nvme0n1 (for example)

Foreman and Proxy versions:
Version 3.8.0

Foreman and Proxy plugin versions:
foreman_discovery|22.0.4
katello 4.10.0

Distribution and version:
RHEL 8

Hello. Sadly, I don’t know the answer, but it may help to also explain why the suggestion does not work. Do you see any error? What is the behavior when you try it? I guess facts can’t be really used since before the provisioning, the host has no facts. We delete all of them when the host enters the build mode. I’m not entirely sure whether this also happens for discovered hosts, but I assume it does.