diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index 6d4abba0d..bd01f3c74 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -27,7 +27,7 @@ class ArticlesController < ApplicationController @articles = @articles.where(featured: true).includes(:user) end - set_surrogate_key_header "feed", @articles.map(&:record_key) + set_surrogate_key_header "feed" response.headers["Surrogate-Control"] = "max-age=600, stale-while-revalidate=30, stale-if-error=86400" render layout: false diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index 95af5431f..0a554e7d2 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -93,7 +93,7 @@ class StoriesController < ApplicationController @stories = @stories.decorate @article_index = true - set_surrogate_key_header "articles-#{@tag}", @stories.map(&:record_key) + set_surrogate_key_header "articles-#{@tag}" response.headers["Surrogate-Control"] = "max-age=600, stale-while-revalidate=30, stale-if-error=86400" render template: "articles/tag_index" end @@ -132,7 +132,7 @@ class StoriesController < ApplicationController @article_index = true @list_of = "podcast-episodes" @podcast_episodes = @podcast.podcast_episodes.order("published_at DESC").limit(30) - set_surrogate_key_header "podcast_episodes", (@podcast_episodes.map { |e| e["record_key"] }) + set_surrogate_key_header "podcast_episodes" render template: "podcast_episodes/index" end @@ -144,7 +144,7 @@ class StoriesController < ApplicationController order("published_at DESC").page(@page).per(8)) @article_index = true @organization_article_index = true - set_surrogate_key_header "articles-org-#{@organization.id}", @stories.map(&:record_key) + set_surrogate_key_header "articles-org-#{@organization.id}" render template: "organizations/show" end @@ -163,7 +163,7 @@ class StoriesController < ApplicationController redirect_if_view_param return if performed? - set_surrogate_key_header "articles-user-#{@user.id}", @stories.map(&:record_key) + set_surrogate_key_header "articles-user-#{@user.id}" render template: "users/show" end