Secure boot is necessary but not in itself sufficient for ransomware prevention. The worst ransomware hijacks the boot process. It can encrypt the entire hard drive. But even with uncompromised secure boot, a ransomware program can still encrypt valuable filesystem directories, just not the entire OS install.