From 55c15bca86c0e7653ec0b8d151127d892d285f50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Tue, 17 Oct 2017 18:29:14 +0200 Subject: [PATCH] Added poll results route --- app/controllers/polls_controller.rb | 4 ++++ config/routes.rb | 1 + 2 files changed, 5 insertions(+) diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 338f72cc4..834c9950d 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -27,4 +27,8 @@ class PollsController < ApplicationController @comment_tree = CommentTree.new(@commentable, params[:page], @current_order) end + def results + @poll = Poll.find(params[:poll_id]) + end + end diff --git a/config/routes.rb b/config/routes.rb index 1fb74aa53..3a7c1dcae 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -113,6 +113,7 @@ Rails.application.routes.draw do end resources :polls, only: [:show, :index] do + get :results resources :questions, controller: 'polls/questions', shallow: true do post :answer, on: :member end