Fix sort_by issue on relation by calling to_a

This commit is contained in:
Luis Ramos
2020-08-06 20:51:53 +01:00
parent 9a9b455e66
commit 55e8dace44

View File

@@ -50,7 +50,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|
[(@shipping_method.has_distributor? d) ? 0 : 1, d.name]
end
# rubocop:enable Style/TernaryParentheses