diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index 43384d85..179343e1 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -98,8 +98,9 @@ class ItemsController < ApplicationController @preview_error = validate_preview @all_appearances = @item.appearances - @appearances_by_occupied_zone = @item.appearances_by_occupied_zone. - sort_by { |z, a| z.label } + @appearances_by_occupied_zone_label = + @item.appearances_by_occupied_zone. + transform_keys(&:label).sort_by { |l, a| l } @selected_item_appearance = @preview_outfit.item_appearances.first @preview_pet_type_options = PetType.where(color: @preview_outfit.color). diff --git a/app/views/items/show.html.haml b/app/views/items/show.html.haml index 3b57d896..37879734 100644 --- a/app/views/items/show.html.haml +++ b/app/views/items/show.html.haml @@ -64,17 +64,17 @@ .item-zones-info %section %h3 Occupies - - if @appearances_by_occupied_zone.present? + - if @appearances_by_occupied_zone_label.present? %ul - - @appearances_by_occupied_zone.each do |zone, appearances_in_zone| + - @appearances_by_occupied_zone_label.each do |label, appearances| %li< - = zone.label - - if item_zone_partial_fit? appearances_in_zone, @all_appearances + = label + - if item_zone_partial_fit? appearances, @all_appearances = " " %span.zone-species-info{ - title: item_zone_species_list(appearances_in_zone) + title: item_zone_species_list(appearances) }< - (#{appearances_in_zone.size} species) + (#{appearances.size} species) - else %span.no-zones (None)