about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2018-01-07 14:53:27 +0900
committerYamagishi Kazutoshi <ykzts@desire.sh>2018-01-07 14:59:12 +0900
commit2af307bce4e936a9ba3f7f5b6ab593e0159dfada (patch)
tree34289673701083455b3ac3c113230bcc574f3c64 /app
parent9e97fbf0afc680ae2bd833d9431f17bcc0a07c17 (diff)
Fix unintended cache
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application_controller.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index f59f2725b..dae1804c2 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -124,15 +124,15 @@ class ApplicationController < ActionController::Base
 
   def render_cached_json(cache_key, **options)
     options[:expires_in] ||= 3.minutes
-    options[:public]     ||= true
     cache_key              = cache_key.join(':') if cache_key.is_a?(Enumerable)
+    cache_public           = options.key?(:public) ? options.delete(:public) : true
     content_type           = options.delete(:content_type) || 'application/json'
 
     data = Rails.cache.fetch(cache_key, { raw: true }.merge(options)) do
       yield.to_json
     end
 
-    expires_in options[:expires_in], public: options[:public]
+    expires_in options[:expires_in], public: cache_public
     render json: data, content_type: content_type
   end