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.
This commit is contained in:
Javi Martín
2019-11-08 19:22:11 +01:00
parent ea2aeab383
commit 9ff285b9cc

View File

@@ -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