adds cache key helper for locale+user status

This commit is contained in:
Juanjo Bazán
2015-08-31 20:39:54 +02:00
parent 574133a50b
commit ef9a386b2b

View File

@@ -0,0 +1,16 @@
module CacheKeysHelper
def locale_and_user_status
@cache_key_user ||= calculate_user_status
"#{I18n.locale}/user:#{@cache_key_user}"
end
def calculate_user_status
user_status = if user_signed_in? && current_user.verified_at.present?
"verified"
elsif user_signed_in?
"signed"
else
"visitor"
end
end
end