Extract scenic view model common methods to concern (#28111)
This commit is contained in:
parent
1666b19559
commit
86500e3312
5 changed files with 34 additions and 33 deletions
|
@ -10,6 +10,8 @@
|
|||
#
|
||||
|
||||
class FollowRecommendation < ApplicationRecord
|
||||
include DatabaseViewRecord
|
||||
|
||||
self.primary_key = :account_id
|
||||
self.table_name = :global_follow_recommendations
|
||||
|
||||
|
@ -17,14 +19,4 @@ class FollowRecommendation < ApplicationRecord
|
|||
belongs_to :account
|
||||
|
||||
scope :localized, ->(locale) { joins(:account_summary).merge(AccountSummary.localized(locale)) }
|
||||
|
||||
def self.refresh
|
||||
Scenic.database.refresh_materialized_view(table_name, concurrently: true, cascade: false)
|
||||
rescue ActiveRecord::StatementInvalid
|
||||
Scenic.database.refresh_materialized_view(table_name, concurrently: false, cascade: false)
|
||||
end
|
||||
|
||||
def readonly?
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue