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

Passing nil in array generates improper SQL #40

Merged
merged 1 commit into from Apr 29, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/arel/predications.rb
Expand Up @@ -41,7 +41,17 @@ def in other
Nodes::Between.new(self, Nodes::And.new([other.begin, other.end])) Nodes::Between.new(self, Nodes::And.new([other.begin, other.end]))
end end
else else
Nodes::In.new self, other if other.include?(nil)
if other.size > 1
set = Nodes::In.new self, other.compact
null = Nodes::Equality.new self, nil
Nodes::Or.new set, null
else
Nodes::Equality.new self, nil
end
else
Nodes::In.new self, other
end
end end
end end


Expand Down