DEV: Fix poll plugin causing error when server reloads in dev env.

This commit is contained in:
Guo Xiang Tan 2020-05-08 14:58:39 +08:00
parent d8d54a92f1
commit 6359a5f8a9
No known key found for this signature in database
GPG Key ID: FBD110179AAC1F20

View File

@ -451,6 +451,7 @@ after_initialize do
mount ::DiscoursePoll::Engine, at: "/polls"
end
reloadable_patch do
Post.class_eval do
attr_accessor :extracted_polls
@ -474,6 +475,7 @@ after_initialize do
User.class_eval do
has_many :poll_votes, dependent: :delete_all
end
end
validate(:post, :validate_polls) do |force = nil|
return unless self.raw_changed? || force