mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
check key class before call Rails.cache.delete
This commit is contained in:
@@ -197,10 +197,16 @@ module Spree
|
||||
|
||||
def clear_preference_cache
|
||||
@payment_method.calculator.preferences.each_key do |key|
|
||||
Rails.cache.delete(@payment_method.calculator.preference_cache_key(key))
|
||||
delete_from_cache @payment_method.calculator.preference_cache_key(key)
|
||||
end
|
||||
end
|
||||
|
||||
def delete_from_cache(cache_key)
|
||||
return unless cache_key.class.in? [String, Integer, Float, Symbol]
|
||||
|
||||
Rails.cache.delete(cache_key)
|
||||
end
|
||||
|
||||
def add_type_to_calculator_attributes(hash)
|
||||
hash["calculator_attributes"]["type"] = hash["calculator_type"]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user