From 36222c1cccdccf8d4b9b3e79e9e831e7fffc1945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Luka=C5=A1=C3=ADk?= Date: Mon, 10 Apr 2017 18:46:22 +0200 Subject: [PATCH] Do not pass nil to the assignment mixin Addressing: [NoMethodError]: undefined method `base_model' for NilClass:Class Method:[rescue in _async_generate_table] app/models/mixins/assignment_mixin.rb:146:in `block in get_assigned_for_target' app/models/mixins/assignment_mixin.rb:146:in `collect' app/models/mixins/assignment_mixin.rb:146:in `get_assigned_for_target' app/models/chargeback/rates_cache.rb:13:in `rates' app/models/chargeback/rates_cache.rb:7:in `get' app/models/chargeback.rb:9:in `block in build_results_for_report_chargeback' app/models/chargeback/consumption_history.rb:31:in `block (2 levels) in for_report' Introduced in 31fac86a962f16c080f453a44dcd20345b8fd24e Lesson learned: when you see two lists with [].compact, it is usually good idea to use compact too. If we merged https://github.com/ManageIQ/manageiq/pull/14090 we wouldn't see this at customer. --- app/models/metric/chargeback_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/metric/chargeback_helper.rb b/app/models/metric/chargeback_helper.rb index 76d16ab75a2..da7f7135449 100644 --- a/app/models/metric/chargeback_helper.rb +++ b/app/models/metric/chargeback_helper.rb @@ -52,7 +52,7 @@ def parents_determining_rate when ContainerProject.name [parent_ems, MiqEnterprise.my_enterprise].compact when Container.name - [parent_ems] + [parent_ems].compact end end end