Fix performance issue in loading payment methods

This was loading and initializing every payment method in the database, and every calculator for each of those payment methods.

🔥
This commit is contained in:
Matt-Yorkley
2021-01-19 15:33:44 +00:00
parent 334e270a11
commit a184075c5c

View File

@@ -116,7 +116,7 @@ module Spree
# Only show payments for the order's distributor
@payment_methods = PaymentMethod.
available(:back_end).
select{ |pm| pm.has_distributor? @order.distributor }
for_distributor(@order.distributor)
@payment_method = if @payment&.payment_method
@payment.payment_method