19 lines
453 B
Ruby
19 lines
453 B
Ruby
class PollsController < ApplicationController
|
|
|
|
load_and_authorize_resource
|
|
|
|
has_filters %w{current expired incoming}
|
|
|
|
def index
|
|
@polls = @polls.send(@current_filter).sort_for_list.page(params[:page])
|
|
end
|
|
|
|
def show
|
|
questions = @poll.questions.sort_for_list.for_render
|
|
|
|
@answerable_questions = questions.answerable_by(current_user)
|
|
@non_answerable_questions = questions.where.not(id: @answerable_questions.pluck(:id))
|
|
end
|
|
|
|
end
|