Creating query to get screenshots visible to a user
This commit is contained in:
parent
53b297da1e
commit
6192e1bc3b
3 changed files with 19 additions and 16 deletions
|
|
@ -1,2 +1,13 @@
|
|||
module PackagesHelper
|
||||
# Return a query of all screenshots that the current user may see
|
||||
# Consists of:
|
||||
# - approved (public) screenshots
|
||||
# - screenshots uploaded by the user (determined by cookie session)
|
||||
def screenshots_visible_to_user
|
||||
self.screenshots.where(
|
||||
# "approved=true"
|
||||
"approved=true OR uploaderhash=?", session[:token]
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue