diff --git a/app/models/closet_list.rb b/app/models/closet_list.rb index 20665032..ea303db9 100644 --- a/app/models/closet_list.rb +++ b/app/models/closet_list.rb @@ -88,10 +88,9 @@ class ClosetList < ApplicationRecord end def self.group_by_owned - h = all.group_by(&:hangers_owned?) - h[true] ||= [] - h[false] ||= [] - h + {true => [], false => []}.tap do |h| + all.each { |list| h[list.hangers_owned?] << list} + end end include VisibilityMethods diff --git a/app/views/items/_item_header.haml b/app/views/items/_item_header.haml index b8cd497e..80b27872 100644 --- a/app/views/items/_item_header.haml +++ b/app/views/items/_item_header.haml @@ -42,7 +42,8 @@ user_closet_hangers_path(current_user)) = form_tag update_quantities_user_item_closet_hangers_path(:user_id => current_user, :item_id => item), :method => :put do .closet-hangers-ownership-groups - - current_user_lists.each do |owned, lists| + - [true, false].each do |owned| + - lists = current_user_lists[owned] %div %h4= closet_lists_group_name(:you, owned) %ul