diff --git a/app/assets/javascripts/polls.js.coffee b/app/assets/javascripts/polls.js.coffee index 650c2596a..5cf792ce2 100644 --- a/app/assets/javascripts/polls.js.coffee +++ b/app/assets/javascripts/polls.js.coffee @@ -1,6 +1,7 @@ App.Polls = generateToken: -> token = '' + rand = '' for n in [0..5] rand = Math.random().toString(36).substr(2) # remove `0.` token = token + rand; diff --git a/app/views/polls/show.html.erb b/app/views/polls/show.html.erb index 1fd305e71..4a6b7b4fa 100644 --- a/app/views/polls/show.html.erb +++ b/app/views/polls/show.html.erb @@ -39,7 +39,7 @@ <% else %> - <% if !@poll.voters.find_by_user_id(current_user).present? %> + <% if poll_voter_token(@poll, current_user).empty? %>