I'd like to fetch all the Active Relations whose ID's are NOT in an array. Like this:
@widgets = Widget.where("id not in (?)", [1, 2, 3])
This works fine. It returns the full Widget table except the those records excluded by the filter array. However, if the filter array is empty, then it doesn't work.
@widgets = Widget.where("id not in (?)", [])
returns "[]", when really I would like the equivalent of Widget.all
I have worked around this by testing first if the filter array is empty, and modifying the query. But the workaround seems like a kludge. Is there a way to get express this 'where' clause so that it returns the entire table if the filter array is empty?