1
0

follow_recommendation.rb 707 B

12345678910111213141516171819202122232425262728
  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: global_follow_recommendations
  5. #
  6. # account_id :bigint(8) primary key
  7. # rank :decimal(, )
  8. # reason :text is an Array
  9. #
  10. class FollowRecommendation < ApplicationRecord
  11. self.primary_key = :account_id
  12. self.table_name = :global_follow_recommendations
  13. belongs_to :account_summary, foreign_key: :account_id, inverse_of: false
  14. belongs_to :account
  15. scope :localized, ->(locale) { joins(:account_summary).merge(AccountSummary.localized(locale)) }
  16. def self.refresh
  17. Scenic.database.refresh_materialized_view(table_name, concurrently: false, cascade: false)
  18. end
  19. def readonly?
  20. true
  21. end
  22. end