rails/arel — pull request #245 by vanderhoorn (2014-02-08 15:28:53+00:00)
Title: Ensure Nodes::In and Nodes::NotIn know how to handle arrays with nil values

Currently ```Nodes::In``` and ```Nodes::NotIn``` do not take into account if an array has a nil value, so it generates queries like ```"users"."id" IN (NULL)``` and ```"users"."id" NOT IN (1, 2, NULL)```. This patch ensures the queries become ```"users"."id" IS NULL``` and ```("users"."id" NOT IN (1, 2) AND "users"."id" IS NOT NULL)```

Note that IN empty array ```[]``` still generates ```1=0``` and NOT IN empty array ```[]``` still generates ```1=1```.

I think this also fixes issue #227.

Method | Argument | Before this patch | After this patch
------------- | ------------- | ------------- | -------------
In | ```[]``` | ```1=0``` | ```1=0```
In | ```[nil]``` | ```"users"."id" IN (NULL)``` | ```"users"."id" IS NULL```
In | ```[1, 2, nil]``` | ```"users"."id" IN (1, 2, NULL)``` | ```("users"."id" IN (1, 2) OR "users"."id" IS NULL)```
NotIn | ```[]``` | ```1=1``` | ```1=1```
NotIn | ```[nil]``` | ```"users"."id" NOT IN (NULL)``` | ```"users"."id" IS NOT NULL```
NotIn | ```[1, 2, nil]``` | ```"users"."id" NOT IN (1, 2, NULL)``` | ```("users"."id" NOT IN (1, 2) AND "users"."id" IS NOT NULL)```