pepe wrote:
> SQL does not use the equality comparison for null values, it uses 'IS
> NULL' instead. Convenient, isn't it? ;)
> 
> Apparently Rails' magic does not go as far as to check if the NIL
> value is one of the values in the array to generate the correct SQL
> statement so I think you'll have to do it yourself and generate a
> string such as:
> 
> conditions = "org is null or org in ('ABC', 'XYZ')"
> 
> This should be so easy to implement that I am not sure why it has not
> already been done.

Found a bug/workaround/fix. Not sure which.

conditions = {:org => ["ABC", "XYZ", "NULL"]}
Defect.count :conditions => conditions


Don't know what to do if the org name really is "NULL".
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to