calls all the sorting scopes the same way

This commit is contained in:
kikito
2015-09-04 14:17:59 +02:00
parent b6699932d1
commit 08c31c5985
4 changed files with 4 additions and 4 deletions

View File

@@ -27,7 +27,7 @@ class Moderation::CommentsController < Moderation::BaseController
private
def load_comments
@comments = Comment.accessible_by(current_ability, :hide).flagged.sorted_for_moderation.includes(:commentable)
@comments = Comment.accessible_by(current_ability, :hide).flagged.sort_for_moderation.includes(:commentable)
end
end

View File

@@ -26,7 +26,7 @@ class Moderation::DebatesController < Moderation::BaseController
private
def load_debates
@debates = Debate.accessible_by(current_ability, :hide).flagged.sorted_for_moderation
@debates = Debate.accessible_by(current_ability, :hide).flagged.sort_for_moderation
end
end

View File

@@ -17,7 +17,7 @@ class Comment < ActiveRecord::Base
scope :recent, -> { order(id: :desc) }
scope :sorted_for_moderation, -> { order(flags_count: :desc, updated_at: :desc) }
scope :sort_for_moderation, -> { order(flags_count: :desc, updated_at: :desc) }
scope :pending_flag_review, -> { where(ignored_flag_at: nil, hidden_at: nil) }
scope :with_ignored_flag, -> { where("ignored_flag_at IS NOT NULL AND hidden_at IS NULL") }
scope :flagged, -> { where("flags_count > 0") }

View File

@@ -23,7 +23,7 @@ class Debate < ActiveRecord::Base
before_save :calculate_hot_score
scope :sorted_for_moderation, -> { order(flags_count: :desc, updated_at: :desc) }
scope :sort_for_moderation, -> { order(flags_count: :desc, updated_at: :desc) }
scope :pending_flag_review, -> { where(ignored_flag_at: nil, hidden_at: nil) }
scope :with_ignored_flag, -> { where("ignored_flag_at IS NOT NULL AND hidden_at IS NULL") }
scope :flagged, -> { where("flags_count > 0") }