Convert to array before using sort_by!

This commit is contained in:
Luis Ramos
2020-05-19 20:44:39 +01:00
parent 6755354196
commit 7b06fdd943

View File

@@ -127,7 +127,7 @@ module Spree
def load_hubs
# rubocop:disable Style/TernaryParentheses
@hubs = Enterprise.managed_by(spree_current_user).is_distributor.sort_by! do |d|
@hubs = Enterprise.managed_by(spree_current_user).is_distributor.to_a.sort_by! do |d|
[(@payment_method.has_distributor? d) ? 0 : 1, d.name]
end
# rubocop:enable Style/TernaryParentheses