Oops, "fits:blue-acara" search should return non-body-specific items

Idk when this regressed exactly, but probably people didn't super
notice because I don't think it's a very common thing to type directly
into the Infinite Closet search box! (It used to be crucial to the old
wardrobe app.)

But I'm using it in the wardrobe app again now, so, fixed!
This commit is contained in:
Emi Matchu 2024-02-25 14:47:37 -08:00
parent a8cbce0864
commit 61a4dcad02

View file

@ -87,8 +87,7 @@ class Item < ApplicationRecord
where("NOT (#{condition})", *zone_ids) where("NOT (#{condition})", *zone_ids)
} }
scope :fits, ->(body_id) { scope :fits, ->(body_id) {
sa = SwfAsset.arel_table joins(:swf_assets).where(swf_assets: {body_id: [body_id, 0]}).distinct
joins(:swf_assets).where(sa[:body_id].eq(body_id)).distinct
} }
scope :not_fits, ->(body_id) { scope :not_fits, ->(body_id) {
i = Item.arel_table i = Item.arel_table