Files
nairobi/app/helpers/cache_keys_helper.rb
2015-09-05 22:02:51 +02:00

24 lines
580 B
Ruby

module CacheKeysHelper
def locale_and_user_status
@cache_key_user ||= calculate_user_status
"#{I18n.locale}/#{@cache_key_user}"
end
def calculate_user_status
user_status = "user"
if user_signed_in?
user_status += ":signed"
user_status += ":verified" if current_user.verified_at.present?
user_status += ":org" if current_user.organization?
user_status += ":admin" if current_user.administrator?
user_status += ":moderator" if current_user.moderator?
else
user_status += ":visitor"
end
user_status
end
end