attr_bitwise icon indicating copy to clipboard operation
attr_bitwise copied to clipboard

Querying `any` does not returns null values

Open giulioprovasi opened this issue 6 years ago • 1 comments

How should I do the following (using #13 as an example too) :

return all users who can see at least english and french content

user 1 => NULL user 2 => en

I assume NULL means any cause : User.first.languages => [:en, :fr, :ca] but : User.with_any_languages(:fr) => []

I am using the same scope :

  scope :with_any_languages, lambda { |*types_sym|
    where(languages_value: bitwise_union(*types_sym, 'languages'))
  }

Is this intended or a bug ?

giulioprovasi avatar Nov 02 '17 10:11 giulioprovasi

@giulioprovasi, are you sure User.first.languages returns [:en, :fr, :ca]? I'm pretty sure it returns [:en, :fr, :ca, :empty].

kmanzana avatar Nov 15 '17 01:11 kmanzana