rzane/baby_squeel

Empty selecting doesn't combine with other selecting

Opened this issue · 1 comments

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 commented

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

I think the issue probably lies here: