Showing number of users' uploaded screenshots at the top

This commit is contained in:
Christoph Haas 2017-01-31 22:44:11 +01:00
parent 82fb26efad
commit bbccbfcc20
3 changed files with 23 additions and 0 deletions

View file

@ -108,4 +108,9 @@ class Screenshot < ApplicationRecord
def self.approved
self.find_by(approved: true)
end
# Query for screenshots being uploaded by a certain user (by their token)
def self.uploaded_by(token)
self.where(approved: false, uploaderhash: token)
end
end