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

Empty selecting doesn't combine with other selecting #80

Open
octavpo opened this issue Sep 17, 2017 · 1 comment
Open

Empty selecting doesn't combine with other selecting #80

octavpo opened this issue Sep 17, 2017 · 1 comment

Comments

@octavpo
Copy link

octavpo commented Sep 17, 2017

For any model I try, a query like:

Package.selecting{}.selecting{name}.first

or

Package.selecting{nil}.selecting{name}.first

fails with an error:

Arel::Visitors::UnsupportedVisitError: Unsupported argument type: NilClass. Construct an Arel node instead.

This happens when the tests in the first selecting are conditioned by an expression that happens to be false. I don't see how I can construct an Arel node in this case. Each of the two selecting works fine by itself. Similar expressions work fine with other constructs like where.has and joining, and select also works fine in squeel. So I'm hoping it's just a bug. Thanks.

@rzane
Copy link
Owner

rzane commented Sep 17, 2017

Yes, this seems like a bug. Would you be willing to submit a pull request?

I think the issue probably lies here:

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