Remove unnecessary map functions in stories controller (#2402)
This commit is contained in:
parent
c68228cda6
commit
9578a15579
2 changed files with 5 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue