follow_recommendation.rb 688 B

123456789101112131415161718192021222324
  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 :safe, -> { joins(:account_summary).merge(AccountSummary.safe) }
  15. scope :localized, ->(locale) { joins(:account_summary).merge(AccountSummary.localized(locale)) }
  16. scope :filtered, -> { joins(:account_summary).merge(AccountSummary.filtered) }
  17. def readonly?
  18. true
  19. end
  20. end