You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
681 B

  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: status_stats
  5. #
  6. # id :bigint(8) not null, primary key
  7. # status_id :bigint(8) not null
  8. # replies_count :bigint(8) default(0), not null
  9. # reblogs_count :bigint(8) default(0), not null
  10. # favourites_count :bigint(8) default(0), not null
  11. # created_at :datetime not null
  12. # updated_at :datetime not null
  13. #
  14. class StatusStat < ApplicationRecord
  15. belongs_to :status, inverse_of: :status_stat
  16. after_commit :reset_parent_cache
  17. private
  18. def reset_parent_cache
  19. Rails.cache.delete("statuses/#{status_id}")
  20. end
  21. end