From 96702e7f6727d9c688b2c6e2527c4a5bfefff886 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 18 Aug 2019 14:55:03 +0200 Subject: Add `tootctl cache recount` command (#11597) --- app/models/status.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'app/models/status.rb') diff --git a/app/models/status.rb b/app/models/status.rb index 23682c84b..0538c4e9e 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -388,13 +388,16 @@ class Status < ApplicationRecord end end + def status_stat + super || build_status_stat + end + private def update_status_stat!(attrs) return if marked_for_destruction? || destroyed? - record = status_stat || build_status_stat - record.update(attrs) + status_stat.update(attrs) end def store_uri -- cgit