follow_recommendation.rb 655 B

1234567891011121314151617181920212223242526
  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: 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. belongs_to :account_summary, foreign_key: :account_id
  13. belongs_to :account, foreign_key: :account_id
  14. scope :localized, ->(locale) { joins(:account_summary).merge(AccountSummary.localized(locale)) }
  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