Avoid N+1 SQL queries with CanCanCan accessibility checks
This commit is contained in:
parent
f154c1838c
commit
b36a49a6cd
6 changed files with 14 additions and 12 deletions
|
|
@ -1,7 +1,7 @@
|
|||
class WelcomeController < ApplicationController
|
||||
def home
|
||||
# TODO: Only approved screenshots!
|
||||
@newest_upload = Screenshot.newest_upload
|
||||
@newest_upload = Screenshot.newest.accessible_by(current_ability, :view).first
|
||||
|
||||
@most_popular_package = Package.with_screenshots.order(visits: :desc).first
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue