From 734ab0da54b4c813a380c6032d4e029a5b24ba6a Mon Sep 17 00:00:00 2001 From: Chris Blanchard Date: Thu, 20 Aug 2015 17:01:42 +0100 Subject: [PATCH] Remove inefficient scope --- app/models/topic.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/models/topic.rb b/app/models/topic.rb index be52570..502a35d 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -32,10 +32,6 @@ class Topic < ActiveRecord::Base scope :basic, :include => [:latest, { forum: :forumer }, :user] scope :ordered, :order => "state DESC, posts.id DESC" - scope :recent, - :conditions => "forumers.id IS NULL AND posts.id = (SELECT id FROM posts AS P WHERE P.topic_id = topics.id ORDER BY id DESC LIMIT 1)", - :order => "posts.id DESC", - :group => "topics.id" scope :latest_page, lambda { |page| {:limit => "#{(page-1)*LATEST_PER_PAGE}, #{(page-1)*LATEST_PER_PAGE+LATEST_PER_PAGE}"} }