-
Notifications
You must be signed in to change notification settings - Fork 897
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
Minor inventory collection enhancements #15108
Minor inventory collection enhancements #15108
Conversation
Add a helper for determining if IC model uses STI
Add checks to build method, build should return nil if we cannot get the unique uuid of the InventoryObject and it should return exiting object if we have it.
@miq-bot add_label enhancement |
Checked commits Ladas/manageiq@63d81f5~...acaa987 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
@@ -378,6 +378,10 @@ def data_collection_finalized? | |||
data_collection_finalized | |||
end | |||
|
|||
def supports_sti? | |||
@supports_sti_cache ||= model_class.column_names.include?("type") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ladas this is the true/false/nil pattern, so you probably need something like the following so you are memoizing and not recalculating when value is false
def supports_sti?
if @supports_sti_cache.nil?
@supports_sti_cache = model_class.column_names.include?("type")
end
@supports_sti_cache
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha, nice catch, you are right of course :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a helper for determining if IC model uses STI. Add checks to build method, build should return nil if we cannot get the unique uuid of the InventoryObject and it should return exiting object if we have it.