From 670b66ade3ff64801264285b1661f9aeb63f5c78 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 13 May 2013 18:47:32 +1000 Subject: [PATCH] better add some tests here tomorrow --- app/controllers/categories_controller.rb | 2 +- app/models/category_list.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb index 7cb0ab4fa4d..5db92be7eda 100644 --- a/app/controllers/categories_controller.rb +++ b/app/controllers/categories_controller.rb @@ -7,7 +7,7 @@ class CategoriesController < ApplicationController skip_before_filter :check_xhr, only: [:index] def index - @list = CategoryList.new(current_user) + @list = CategoryList.new(guardian) discourse_expires_in 1.minute respond_to do |format| format.html { render } diff --git a/app/models/category_list.rb b/app/models/category_list.rb index 9625281eacb..00f7c9343df 100644 --- a/app/models/category_list.rb +++ b/app/models/category_list.rb @@ -4,6 +4,8 @@ class CategoryList attr_accessor :categories, :topic_users, :uncategorized def initialize(guardian) + guardian ||= Guardian.new + @categories = Category .includes(featured_topics: [:category]) .includes(:featured_users)