Rails, Ransack: How to search HABTM relationship for “all” matches instead of “any”
问题 I'm wondering if anyone has experience using Ransack with HABTM relationships. My app has photos which have a habtm relationship with terms (terms are like tags). Here's a simplified explanation of what I'm experiencing: I have two photos: Photo 1 and Photo 2. They have the following terms: Photo 1: A, B, C Photo 2: A, B, D I built a ransack form, and I make checkboxes in the search form for all the terms, like so: - terms.each do |t| = check_box_tag 'q[terms_id_in][]', t.id If I use: q[terms