Use guard clause

This commit is contained in:
Rob Harrington
2017-09-11 20:36:52 +10:00
parent 0e42c1cf30
commit 0bbaafbd41

View File

@@ -73,7 +73,8 @@ module Spree
end
def restrict_stripe_account_change
return unless @payment_method.try(:type) == "Spree::Gateway::StripeConnect"
return unless @payment_method
return unless @payment_method.type == "Spree::Gateway::StripeConnect"
return unless @payment_method.preferred_enterprise_id.andand > 0
@stripe_account_holder = Enterprise.find(@payment_method.preferred_enterprise_id)