Remove `default_scope`

This commit is contained in:
Robin Ward 2013-11-06 16:56:49 -05:00
parent 006e72ff5a
commit 01b768392a
2 changed files with 3 additions and 4 deletions

View File

@ -45,8 +45,6 @@ class Category < ActiveRecord::Base
has_one :category_search_data has_one :category_search_data
belongs_to :parent_category, class_name: 'Category' belongs_to :parent_category, class_name: 'Category'
default_scope order('position')
scope :latest, ->{ order('topic_count desc') } scope :latest, ->{ order('topic_count desc') }
scope :secured, ->(guardian = nil) { scope :secured, ->(guardian = nil) {

View File

@ -33,8 +33,9 @@ class Site
@categories ||= begin @categories ||= begin
categories = Category categories = Category
.secured(@guardian) .secured(@guardian)
.latest .includes(:topic_only_relative_url)
.includes(:topic_only_relative_url).to_a .order(:position)
.to_a
allowed_topic_create = Set.new(Category.topic_create_allowed(@guardian).pluck(:id)) allowed_topic_create = Set.new(Category.topic_create_allowed(@guardian).pluck(:id))