diff --git a/app/models/live_metric.rb b/app/models/live_metric.rb index 3decbdd2d81..fadf0815de1 100644 --- a/app/models/live_metric.rb +++ b/app/models/live_metric.rb @@ -3,6 +3,13 @@ class LiveMetric < ActsAsArModel class LiveMetricError < RuntimeError; end + # all attributes are virtual + # - attributes are dynamically generated and would be too much work to query/declare them all + # - returning true gets the column names into the REST query (via :includes) + def self.virtual_attribute?(_c) + true + end + def self.find(*args) raw_query = args[1] validate_raw_query(raw_query) diff --git a/app/models/miq_report/generator.rb b/app/models/miq_report/generator.rb index d80cfebf9a0..cfcf39987d8 100644 --- a/app/models/miq_report/generator.rb +++ b/app/models/miq_report/generator.rb @@ -88,7 +88,7 @@ def include_as_hash(includes = include, klass = nil) if klass.nil? klass = db_class result = {} - cols.each { |c| result.merge!(c.to_sym => {}) if klass.virtual_attribute?(c) || klass == LiveMetric } if cols + cols.each { |c| result.merge!(c.to_sym => {}) if klass.virtual_attribute?(c) } if cols end if includes.kind_of?(Hash)