Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove LiveMetric hardcoded column includes #13640

Merged
merged 1 commit into from
Feb 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/models/live_metric.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/models/miq_report/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get_include_for_find(includes, 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)
Expand Down