Adds a new sort scope for proposals

This commit is contained in:
kikito
2015-09-13 20:27:58 +02:00
parent 50148f0aaf
commit 822b2c728e

View File

@@ -30,6 +30,7 @@ class Proposal < ActiveRecord::Base
scope :sort_by_created_at, -> { order(created_at: :desc) }
scope :sort_by_most_commented, -> { order(comments_count: :desc) }
scope :sort_by_random, -> { order("RANDOM()") }
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
def total_votes
cached_votes_up