0
0
Fork 0

Remove default_scope from Admin::ActionLog (#28026)

This commit is contained in:
Matt Jankowski 2023-11-29 05:39:59 -05:00 committed by GitHub
parent 291dc04e67
commit e48ecd2929
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 16 deletions

View file

@ -131,25 +131,25 @@ class Report < ApplicationRecord
Admin::ActionLog.where(
target_type: 'Report',
target_id: id
).unscope(:order).arel,
).arel,
Admin::ActionLog.where(
target_type: 'Account',
target_id: target_account_id
).unscope(:order).arel,
).arel,
Admin::ActionLog.where(
target_type: 'Status',
target_id: status_ids
).unscope(:order).arel,
).arel,
Admin::ActionLog.where(
target_type: 'AccountWarning',
target_id: AccountWarning.where(report_id: id).select(:id)
).unscope(:order).arel,
).arel,
].reduce { |union, query| Arel::Nodes::UnionAll.new(union, query) }
Admin::ActionLog.from(Arel::Nodes::As.new(subquery, Admin::ActionLog.arel_table))
Admin::ActionLog.latest.from(Arel::Nodes::As.new(subquery, Admin::ActionLog.arel_table))
end
private