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

nil.union(something_not_nil) #17

Closed
Alagaesia93 opened this issue Aug 9, 2017 · 1 comment
Closed

nil.union(something_not_nil) #17

Alagaesia93 opened this issue Aug 9, 2017 · 1 comment

Comments

@Alagaesia93
Copy link

I suppose it's not a bug, but maybe someone has found a workaround.

I have 6 objects initialised with 6 total different queries and I want to chain unions.

obj1.union(obj2).union(obj3) and so on

Each one can be nil, and I want to union all the results. There is no default (otherwise I could use default_obj.union(obj1) and so on).

Any ideas?

@brianhempel
Copy link
Owner

[query1, query2, query3, query4, query5, query6].compact.reduce(:union)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants