From 9ff285b9cc7ad4be6a6460e9c178d31beca2f296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 8 Nov 2019 19:22:11 +0100 Subject: [PATCH] Use `find_by_slug_or_id!` to find a poll We were manually doing a similar thing - only we weren't raising an exception when we should. --- app/controllers/polls_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 18ca97bf8..78b11d321 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -43,7 +43,7 @@ class PollsController < ApplicationController private def load_poll - @poll = Poll.find_by(slug: params[:id]) || Poll.find_by(id: params[:id]) + @poll = Poll.find_by_slug_or_id!(params[:id]) end def load_active_poll