From 625182176756fd6e85170e8f3980da016140858a Mon Sep 17 00:00:00 2001 From: Abhi Yerra Date: Tue, 10 Oct 2017 21:17:01 +0000 Subject: [PATCH] rails caching --- FireResponse/app/controllers/tables_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/FireResponse/app/controllers/tables_controller.rb b/FireResponse/app/controllers/tables_controller.rb index da01b27..54eadad 100644 --- a/FireResponse/app/controllers/tables_controller.rb +++ b/FireResponse/app/controllers/tables_controller.rb @@ -2,9 +2,11 @@ class TablesController < ApplicationController AirtableSheets.each do |k,v| define_method(k) do - ::Rails.cache.fetch("cache/#{k}", expires_in: 30.seconds) do - render json: v.all.to_json + records = ::Rails.cache.fetch("cache/#{k}", expires_in: 30.seconds) do + v.all.to_json end + + render json: records end end end