account_summary.rb 801 B

1234567891011121314151617181920212223242526
  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: account_summaries
  5. #
  6. # account_id :bigint(8) primary key
  7. # language :string
  8. # sensitive :boolean
  9. #
  10. class AccountSummary < ApplicationRecord
  11. self.primary_key = :account_id
  12. scope :safe, -> { where(sensitive: false) }
  13. scope :localized, ->(locale) { where(language: locale) }
  14. scope :filtered, -> { joins(arel_table.join(FollowRecommendationSuppression.arel_table, Arel::Nodes::OuterJoin).on(arel_table[:account_id].eq(FollowRecommendationSuppression.arel_table[:account_id])).join_sources).where(FollowRecommendationSuppression.arel_table[:id].eq(nil)) }
  15. def self.refresh
  16. Scenic.database.refresh_materialized_view(table_name, concurrently: false, cascade: false)
  17. end
  18. def readonly?
  19. true
  20. end
  21. end