mardi 21 avril 2015

Datamapper - Find in Flag field

I am using Datamapper in my Rails application. I have a Flag field defined in this manner:

class Days
  VALUES = [:mon, :tue, :wed, :thu, :fri, :sat, :sun]

  property :on_days, Flag[*VALUES]
end

Now when I make a query to list all objects that have the following set say: [:mon, :thu],

Days.all(:on_days => [:mon, :thu])

It returns only those objects that have [:mon, :thu] only. I would also like those objects that have other days too in addition to [:mon, :thu], like [:mon, :tue, :thu]. Can anyone help me in this ?

Aucun commentaire:

Enregistrer un commentaire