Proposal related polls won't appear in votes section
Proposal related polls won't be shown in the public votes section.
This commit is contained in:
@@ -9,7 +9,7 @@ class PollsController < ApplicationController
|
||||
::Poll::Answer # trigger autoload
|
||||
|
||||
def index
|
||||
@polls = @polls.send(@current_filter).includes(:geozones).sort_for_list.page(params[:page])
|
||||
@polls = @polls.public_polls.send(@current_filter).includes(:geozones).sort_for_list.page(params[:page])
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
@@ -27,6 +27,7 @@ class Poll < ActiveRecord::Base
|
||||
accepts_nested_attributes_for :questions, reject_if: :all_blank, allow_destroy: true
|
||||
|
||||
scope :for, ->(element) { where(related: element) }
|
||||
scope :public_polls, -> { where(related: nil) }
|
||||
scope :current, -> { where('starts_at <= ? and ? <= ends_at', Date.current.beginning_of_day, Date.current.beginning_of_day) }
|
||||
scope :incoming, -> { where('? < starts_at', Date.current.beginning_of_day) }
|
||||
scope :expired, -> { where('ends_at < ?', Date.current.beginning_of_day) }
|
||||
|
||||
Reference in New Issue
Block a user