diff --git a/app/controllers/about_controller.rb b/app/controllers/about_controller.rb index 259f2f10..f6d02c9c 100644 --- a/app/controllers/about_controller.rb +++ b/app/controllers/about_controller.rb @@ -5,18 +5,6 @@ class AboutController < ApplicationController def about cache "about_counters", expires_in: 1.hour do - user_count = User - .where.not(confirmed_at: nil) - .where("answered_count > 0") - .count - - current_ban_count = UserBan - .current - .joins(:user) - .where.not("users.confirmed_at": nil) - .where("users.answered_count > 0") - .count - @users = user_count - current_ban_count @questions = Question.count(:id) @answers = Answer.count(:id) @@ -28,4 +16,18 @@ class AboutController < ApplicationController def privacy_policy; end def terms; end + + private + + def user_count = User + .where.not(confirmed_at: nil) + .where("answered_count > 0") + .count + + def current_ban_count = UserBan + .current + .joins(:user) + .where.not("users.confirmed_at": nil) + .where("users.answered_count > 0") + .count end