-
Notifications
You must be signed in to change notification settings - Fork 898
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
MiqExpression#contains improvement #20199
Conversation
717f9d2
to
f01c37e
Compare
Checked commits kbrock/manageiq@086b836~...f01c37e with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.28.0, and yamllint |
@@ -1373,8 +1367,8 @@ def to_arel(exp, tz) | |||
# Only support for tags of the main model | |||
if exp[operator].key?("tag") | |||
tag = Tag.parse(exp[operator]["tag"]) | |||
ids = tag.model.find_tagged_with(:any => parsed_value, :ns => tag.namespace).pluck(:id) | |||
tag.model.arel_attribute(:id).in(ids) | |||
ids = tag.target.find_tagged_with(:any => parsed_value, :ns => tag.namespace).pluck(:id) |
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.
I can change this to not pluck the id and become an inner query.
It would remove some arel, but would add a few lines to make that work smothly
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.
LGTM, reviewed with @kbrock
kicking |
Before
After
MiqExpression::Target#*_supports_sql?
instead of rewriting that logic.added 36 lines of tests and 10 lines of comments - so feature for nothing and the code for free :)