diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2021-04-12 12:37:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-12 12:37:14 +0200 |
commit | f7117646afddb2676e9275d8efe90c3a20c59021 (patch) | |
tree | efb9ba8f7b22d27b0a1ea595cfa30030f5d03b09 /app/models/account_summary.rb | |
parent | ad61265268f13d9b2a04e2e176724d8a7376f85a (diff) |
Add cold-start follow recommendations (#15945)
Diffstat (limited to 'app/models/account_summary.rb')
-rw-r--r-- | app/models/account_summary.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/models/account_summary.rb b/app/models/account_summary.rb new file mode 100644 index 000000000..6a7e17c6c --- /dev/null +++ b/app/models/account_summary.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true +# == Schema Information +# +# Table name: account_summaries +# +# account_id :bigint(8) primary key +# language :string +# sensitive :boolean +# + +class AccountSummary < ApplicationRecord + self.primary_key = :account_id + + scope :safe, -> { where(sensitive: false) } + scope :localized, ->(locale) { where(language: locale) } + 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)) } + + def self.refresh + Scenic.database.refresh_materialized_view(table_name, concurrently: true, cascade: false) + end + + def readonly? + true + end +end |