Memoize Spree::PaypalController#payment_method

This gets called 4 or 5 times in a single request just to read basic attributes from the object. The query doesn't need to be repeated each time
This commit is contained in:
Matt-Yorkley
2020-11-18 13:44:11 +00:00
parent 6d0d4b5096
commit dd8f139c1b

View File

@@ -67,7 +67,7 @@ Spree::PaypalController.class_eval do
private
def payment_method
Spree::PaymentMethod.find(params[:payment_method_id])
@payment_method ||= Spree::PaymentMethod.find(params[:payment_method_id])
end
def permit_parameters!