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

main
Eugen Rochko 2 years ago committed by GitHub
parent a4fa9e23fc
commit 088dc0ec5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -39,13 +39,12 @@ class Poll < ApplicationRecord
before_validation :prepare_options, if: :local? before_validation :prepare_options, if: :local?
before_validation :prepare_votes_count before_validation :prepare_votes_count
before_validation :prepare_cached_tallies
after_initialize :prepare_cached_tallies
after_commit :reset_parent_cache, on: :update after_commit :reset_parent_cache, on: :update
def loaded_options 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 end
def possibly_stale? def possibly_stale?

Loading…
Cancel
Save