From 6994f6d7fedf9f964295249deba7a67da67e1a49 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Fri, 6 Oct 2017 15:28:25 +0200 Subject: [PATCH] Remove random token generation, we'll use JS on the client when its empty --- app/helpers/polls_helper.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/app/helpers/polls_helper.rb b/app/helpers/polls_helper.rb index a0a4736aa..feb4c42e2 100644 --- a/app/helpers/polls_helper.rb +++ b/app/helpers/polls_helper.rb @@ -43,13 +43,7 @@ module PollsHelper def poll_answer_author_token(poll, author) existing_token = Poll::Answer.where(question: poll.questions, author: author) - existing_token.present? ? existing_token.first.token : poll_answer_unique_token + existing_token.present? ? existing_token.first.token : '' end - def poll_answer_unique_token - loop do - token = SecureRandom.hex(32) - break token unless Poll::Answer.where(token: token).exists? - end - end end