I'm not even sure if this title is the best description.
I'm building some basic filtering capabilities via a form for my events. Events have a category from a select drop down.
Now when you want to filter, you can select via checkboxes the categories you want to display.
I'm a bit stumped how to do that. Is it possible to do it all in one query? Or do you separate it into 1 for each category?
My old query was this current_user.friends.events(:event, :rel).where("rel.admin = {admin_p} AND event.detail = {detail_p}").params(admin_p: true, detail_p: true).pluck(:event)
In this case, I would need something like event.category = category1, category2, cateogry3
. Obviously this isn't how it's written. Ways to achieve this?
In cypher,
IN
lets you match results within an array.That would match events with any of the uuid properties in that array. In the Ruby gem, this is handled automatically for you in QueryProxy if you use an array in a where method.
In your form, ensure that each checkbox's value corresponds with its ID. Put those IDs into an array and search as demonstrated above.