Fix regression in tootctl search deploy caused by unloaded attribute (#18514)

This commit is contained in:
Eugen Rochko 2022-05-26 18:05:47 +02:00 committed by GitHub
parent 3143aec7f1
commit 5be3d071f2

View file

@ -39,13 +39,12 @@ class Poll < ApplicationRecord
before_validation :prepare_options, if: :local?
before_validation :prepare_votes_count
after_initialize :prepare_cached_tallies
before_validation :prepare_cached_tallies
after_commit :reset_parent_cache, on: :update
def loaded_options
options.map.with_index { |title, key| Option.new(self, key.to_s, title, show_totals_now? ? cached_tallies[key] : nil) }
options.map.with_index { |title, key| Option.new(self, key.to_s, title, show_totals_now? ? (cached_tallies[key] || 0) : nil) }
end
def possibly_stale?