Adds Debate#for_render
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user