From 2c989f3eb3a86f5541fd12fd638f205c48350c58 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 15 Oct 2014 15:29:20 -0400 Subject: [PATCH] FIX: ActiveRecord error when calling `find` for the topic list key. --- app/models/topic_list.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/topic_list.rb b/app/models/topic_list.rb index c5ba27a52..0d9980d2d 100644 --- a/app/models/topic_list.rb +++ b/app/models/topic_list.rb @@ -20,11 +20,11 @@ class TopicList def preload_key if @opts[:category] - c = Category.find(@opts[:category_id]) - "topic_list_#{c.url.sub(/^\//, '')}/l/#{@filter}" - else - "topic_list_#{@filter}" + c = Category.where(id: @opts[:category_id]).first + return "topic_list_#{c.url.sub(/^\//, '')}/l/#{@filter}" if c end + + "topic_list_#{@filter}" end # Lazy initialization