Adds Debate#for_render

This commit is contained in:
kikito
2015-08-26 19:40:37 +02:00
parent 048f7c9b73
commit 9112cacde4
2 changed files with 2 additions and 1 deletions

View File

@@ -5,7 +5,7 @@ class DebatesController < ApplicationController
respond_to :html, :js respond_to :html, :js
def index def index
@debates = Debate.includes(:tags).includes(:inappropiate_flags).search(params).page(params[:page]) @debates = Debate.search(params).page(params[:page]).for_render
set_debate_votes(@debates) set_debate_votes(@debates)
end end

View File

@@ -27,6 +27,7 @@ class Debate < ActiveRecord::Base
scope :pending, -> { where(archived_at: nil, hidden_at: nil) } scope :pending, -> { where(archived_at: nil, hidden_at: nil) }
scope :archived, -> { where("archived_at IS NOT NULL AND hidden_at IS NULL") } scope :archived, -> { where("archived_at IS NOT NULL AND hidden_at IS NULL") }
scope :flagged_as_inappropiate, -> { where("inappropiate_flags_count > 0") } scope :flagged_as_inappropiate, -> { where("inappropiate_flags_count > 0") }
scope :for_render, -> { includes(:tags) }
# Ahoy setup # Ahoy setup
visitable # Ahoy will automatically assign visit_id on create visitable # Ahoy will automatically assign visit_id on create