1. I think this 2 lines code must be replaced by: number_of_drives = number_of_drives < 0 ? t('unknown') : @node.number_of_drives
2. Why you place code in template instead controller? I think it is not correct.