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
fixes #7834 - properly process incoming and updated hypervisors #4708
Conversation
System.create_hypervisor(environment.id, content_view.id, hypervisor_attrs) | ||
created = [] | ||
consumers_attrs[:created].map do |hypervisor| | ||
created << System.create_hypervisor(environment.id, content_view.id, hypervisor) | ||
end if consumers_attrs[:created] |
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.
Why use map
if you're not setting it to anything? Here you go:
created = (consumers_attrs[:created] || []).map do |hypervisor|
System.create_hypervisor(environment.id, content_view.id, hypervisor)
end
eb4ab3b
to
e27dead
Compare
@daviddavis updated, thanks! Hope you don't mind but I left the var initialization in place. |
That works. APJ |
System.create_hypervisor(environment.id, content_view.id, hypervisor_attrs) | ||
created = [] | ||
consumers_attrs[:created].each do |hypervisor| | ||
created << System.create_hypervisor(environment.id, content_view.id, hypervisor) | ||
end if consumers_attrs[:created] |
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.
My preference is for trailing if's to only be on single-line statements. This is more readable to me:
if consumers_attrs[:created]
consumers_attrs[:created].each do |hypervisor|
created << System.create_hypervisor(environment.id, content_view.id, hypervisor)
end
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.
+1. To be fair though, this was not introduced by @thomasmckay.
APJ, I won't withold my ack because of the above, just a nitpick, but if you feel like changing it :-) |
e27dead
to
81afb11
Compare
81afb11
to
6057a37
Compare
changed unneeded map to each changed 'if' style on code rebased rubocop fix
6057a37
to
f753644
Compare
fixes #7834 - properly process incoming and updated hypervisors
No description provided.