Remove cacheing for preferred_languages_array (#4689)

This commit is contained in:
Molly Struve 2019-11-01 15:15:59 -05:00 committed by Ben Halpern
parent 5ab15f6861
commit fd11d17973

View file

@ -236,7 +236,7 @@ class User < ApplicationRecord
def followed_articles
Article.tagged_with(cached_followed_tag_names, any: true).
union(Article.where(user_id: cached_following_users_ids)).
where(language: cached_preferred_langs, published: true)
where(language: preferred_languages_array, published: true)
end
def cached_following_users_ids
@ -266,12 +266,6 @@ class User < ApplicationRecord
end
end
def cached_preferred_langs
Rails.cache.fetch("user-#{id}-#{updated_at}/cached_preferred_langs", expires_in: 24.hours) do
preferred_languages_array
end
end
# handles both old (prefer_language_*) and new (Array of language codes) formats
def preferred_languages_array
# return @prefer_languages_array if defined? @preferred_languages_array