diff --git a/app/jobs/refresh_products_cache_job.rb b/app/jobs/refresh_products_cache_job.rb index 0c66925be8..2662237dc1 100644 --- a/app/jobs/refresh_products_cache_job.rb +++ b/app/jobs/refresh_products_cache_job.rb @@ -2,12 +2,15 @@ require 'open_food_network/products_renderer' RefreshProductsCacheJob = Struct.new(:distributor_id, :order_cycle_id) do def perform - Rails.cache.write "products-json-#{distributor_id}-#{order_cycle_id}", products_json + Rails.cache.write(key, products_json) end - private + def key + "products-json-#{distributor_id}-#{order_cycle_id}" + end + def products_json distributor = Enterprise.find distributor_id order_cycle = OrderCycle.find order_cycle_id