Remove `default_scope`
This commit is contained in:
parent
006e72ff5a
commit
01b768392a
|
@ -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) {
|
||||||
|
|
|
@ -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))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue