Update to Rails 7.2
This commit is contained in:
parent
932a43daac
commit
25672aabb0
31 changed files with 836 additions and 435 deletions
|
|
@ -51,6 +51,13 @@ class Package < ApplicationRecord
|
|||
where(id: subselect)
|
||||
end
|
||||
|
||||
# Return a query of all packages that have approved screenshots
|
||||
def self.with_public_screenshots
|
||||
# Query for all packages who's ID appears in a screenshot's "package_id" field
|
||||
subselect = Screenshot.visible.approved.select(:package_id)
|
||||
where(id: subselect)
|
||||
end
|
||||
|
||||
# Return a list of packages that have screenshots to be moderated
|
||||
def self.need_moderation
|
||||
Package.joins(:screenshots).where('screenshots.approved=false').distinct(:name)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class Screenshot < ApplicationRecord
|
|||
default_scope { order(approved: :asc, hidden: :asc, created_at: :desc) }
|
||||
|
||||
scope :approved, -> { where(approved: true) }
|
||||
scope :visible, -> { where(hidden: false) }
|
||||
|
||||
# Shrine
|
||||
include ImageUploader::Attachment(:simage) # adds an `simage` virtual attribute
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue