Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Add memoization to Store#supported_currencies_list

Damian Legawiec4c91e573c32c
diff --git a/core/app/models/spree/store.rb b/core/app/models/spree/store.rb
index 47f9061fbe..4807d3cc60 100644
--- a/core/app/models/spree/store.rb
+++ b/core/app/models/spree/store.rb
@@ -44,7 +44,7 @@ module Spree
end
def supported_currencies_list
- (read_attribute(:supported_currencies).to_s.split(',') << default_currency).map(&:to_s).map do |code|
+ @supported_currencies_list ||= (read_attribute(:supported_currencies).to_s.split(',') << default_currency).map(&:to_s).map do |code|
::Money::Currency.find(code.strip)
end.uniq.compact
end