From 753d39f30ddf2c03948b55072f5d606dd3c22cef Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Tue, 9 Oct 2018 12:51:49 -0400 Subject: [PATCH] Fix NoMethodError in polls#voters --- plugins/poll/plugin.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/poll/plugin.rb b/plugins/poll/plugin.rb index 44f818cabd5..1f8dc37da37 100644 --- a/plugins/poll/plugin.rb +++ b/plugins/poll/plugin.rb @@ -245,6 +245,7 @@ after_initialize do post = Post.find_by(id: post_id) raise Discourse::InvalidParameters.new("post_id is invalid") if !post + raise Discourse::InvalidParameters.new("no poll exists for this post_id") unless post.custom_fields[DiscoursePoll::POLLS_CUSTOM_FIELD] poll = post.custom_fields[DiscoursePoll::POLLS_CUSTOM_FIELD][poll_name] raise Discourse::InvalidParameters.new("poll_name is invalid") if !poll