From ee469ccd2902d64a4d86d11b6813a76c945a7267 Mon Sep 17 00:00:00 2001 From: Sam Seed Date: Thu, 15 Dec 2022 11:43:06 +0000 Subject: [PATCH] feat: check if managing org exists before trying to show it --- app/models/form/lettings/questions/managing_organisation.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/form/lettings/questions/managing_organisation.rb b/app/models/form/lettings/questions/managing_organisation.rb index b7a22954c..a2c14398d 100644 --- a/app/models/form/lettings/questions/managing_organisation.rb +++ b/app/models/form/lettings/questions/managing_organisation.rb @@ -16,7 +16,9 @@ class Form::Lettings::Questions::ManagingOrganisation < ::Form::Question return opts unless current_user return opts unless log - opts = opts.merge({ log.managing_organisation.id => log.managing_organisation.name} ) + if log.managing_organisation.present? + opts = opts.merge({ log.managing_organisation.id => log.managing_organisation.name} ) + end if current_user.support? if log.owning_organisation.holds_own_stock?