From 598a9dac52db361b9b297b3005a236e8d0cb4648 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Mon, 17 Jun 2024 13:03:12 -0700 Subject: [PATCH] Oops, fix crashing bug when Item Getting Guide has *no* Dyeworks Lmao I've been testing with an outfit that has all the kinds of items, so I didn't notice that this new refactor to `@items[:dyeworks]` style of tracking the items returns `nil` when there's none, instead of `[]`. (I always make this mistake when I use `group_by` lmao sob) In this change, we give the `@items` hash a default value, so that will stop happening! --- app/controllers/items_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index ef0810f7..e086c031 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -117,7 +117,7 @@ class ItemsController < ApplicationController item_ids = params[:ids].split(",") @all_items = Item.where(id: item_ids).includes(:nc_mall_record). includes(:dyeworks_base_item).order(:name).limit(50) - @items = @all_items.group_by(&:source) + @items = @all_items.group_by(&:source).tap { |i| i.default = [] } assign_closeted!(@all_items)