Revert "Use symbols instead of strings in order clause"

Breaks 1.9.3 compat

This reverts commit 09a2d9e12c.
This commit is contained in:
Sam 2014-02-28 15:07:55 +11:00
parent f6197c2eec
commit 560b5356d5
1 changed files with 9 additions and 9 deletions

View File

@ -102,22 +102,22 @@ class Topic < ActiveRecord::Base
attr_accessor :include_last_poster
# The regular order
scope :topic_list_order, -> { order(bumped_at: :desc) }
scope :topic_list_order, lambda { order('topics.bumped_at desc') }
# Return private message topics
scope :private_messages, -> {
scope :private_messages, lambda {
where(archetype: Archetype.private_message)
}
scope :listable_topics, -> { where('topics.archetype <> ?', [Archetype.private_message]) }
scope :listable_topics, lambda { where('topics.archetype <> ?', [Archetype.private_message]) }
scope :by_newest, -> { order(created_at: :desc, id: :desc) }
scope :by_newest, -> { order('topics.created_at desc, topics.id desc') }
scope :visible, -> { where(visible: true) }
scope :created_since, -> (time_ago) { where('created_at > ?', time_ago) }
scope :created_since, lambda { |time_ago| where('created_at > ?', time_ago) }
scope :secured, -> (guardian=nil) {
scope :secured, lambda {|guardian=nil|
ids = guardian.secure_category_ids if guardian
# Query conditions
@ -203,11 +203,11 @@ class Topic < ActiveRecord::Base
end
def self.top_viewed(max = 10)
Topic.listable_topics.visible.secured.order(views: :desc).limit(max)
Topic.listable_topics.visible.secured.order('views desc').limit(max)
end
def self.recent(max = 10)
Topic.listable_topics.visible.secured.order(created_at: :desc).limit(max)
Topic.listable_topics.visible.secured.order('created_at desc').limit(max)
end
def self.count_exceeds_minimum?
@ -215,7 +215,7 @@ class Topic < ActiveRecord::Base
end
def best_post
posts.order(score: :desc).limit(1).first
posts.order('score desc').limit(1).first
end
# all users (in groups or directly targetted) that are going to get the pm