Rails query not working

I’m trying first to filter items that don’t have any associated sales it seems weird the way i’ve been doing it because without the item_id in sales the association can’t be made but you can see i’m trying to search only unsold items that have a price in the category with id matching item_type_id that match the search, for now, just in the :title column Can someone correct my syntax This just displays all records

  @items=Item.includes(:sales).where("unit_price is not null").where(:sales => { :item_id => nil } ).where("item_type_id=? and title like ?", @item_type_id, "%#{params[:search]}%").order(:title)