Simplify AccountSummary.filtered query generation (#28868)
				
					
				
			This commit is contained in:
		@@ -12,9 +12,11 @@
 | 
				
			|||||||
class AccountSummary < ApplicationRecord
 | 
					class AccountSummary < ApplicationRecord
 | 
				
			||||||
  self.primary_key = :account_id
 | 
					  self.primary_key = :account_id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  has_many :follow_recommendation_suppressions, primary_key: :account_id, foreign_key: :account_id, inverse_of: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  scope :safe, -> { where(sensitive: false) }
 | 
					  scope :safe, -> { where(sensitive: false) }
 | 
				
			||||||
  scope :localized, ->(locale) { where(language: locale) }
 | 
					  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)) }
 | 
					  scope :filtered, -> { where.missing(:follow_recommendation_suppressions) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def self.refresh
 | 
					  def self.refresh
 | 
				
			||||||
    Scenic.database.refresh_materialized_view(table_name, concurrently: false, cascade: false)
 | 
					    Scenic.database.refresh_materialized_view(table_name, concurrently: false, cascade: false)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user