about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-03-04 00:39:06 +0100
committerEugen Rochko <eugen@zeonfederated.com>2019-03-04 00:39:06 +0100
commite13d3792f322c6313fde10d639b13bc31723ec63 (patch)
treef78d71564fd4f2cd83dfb40ccf6f0fcd6254f39e /app/models
parent5dfa4336985616cf5652de2f1cf794d8f740424e (diff)
Make sure the poll is created before storing its id (#10142)
* Make sure the poll is created before storing its id

* Fix updating poll results

* Support fetching Question activities from the search bar
Diffstat (limited to 'app/models')
-rw-r--r--app/models/status.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index db3c130de..74deeeb50 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -255,7 +255,7 @@ class Status < ApplicationRecord
   before_validation :set_conversation
   before_validation :set_local
 
-  before_save :set_poll_id
+  after_create :set_poll_id
 
   class << self
     def selectable_visibilities
@@ -446,7 +446,7 @@ class Status < ApplicationRecord
   end
 
   def set_poll_id
-    self.poll_id = owned_poll.id unless owned_poll.nil?
+    update_column(:poll_id, owned_poll.id) unless owned_poll.nil?
   end
 
   def set_visibility