Add Bullet gem for dev & fix N+1 queries issues for core index actions
This commit is contained in:
@@ -12,7 +12,7 @@ class ContestantsController < ApplicationController
|
||||
def index
|
||||
authorize @contest
|
||||
|
||||
@contestants = @contest.contestants.sort_by { |contestant| contestant.name }
|
||||
@contestants = @contest.contestants.includes([ :completions, :offline ]).sort_by { |contestant| contestant.name }
|
||||
filter_contestants_per_category
|
||||
end
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class ContestsController < ApplicationController
|
||||
def index
|
||||
authorize :contest
|
||||
|
||||
@contests = current_user.contests
|
||||
@contests = current_user.contests.includes([ :contestants, puzzles: [ :image_attachment ] ])
|
||||
@title = I18n.t("contests.index.title", username: current_user.username)
|
||||
end
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ class PuzzlesController < ApplicationController
|
||||
authorize @contest
|
||||
|
||||
@title = @contest.name
|
||||
@puzzles = @contest.puzzles.order(:id)
|
||||
@puzzles = @contest.puzzles.includes([ :image_attachment ]).order(:id)
|
||||
end
|
||||
|
||||
def edit
|
||||
|
||||
@@ -7,7 +7,7 @@ class UsersController < ApplicationController
|
||||
authorize :user
|
||||
|
||||
@title = t("users.index.title")
|
||||
@users = User.all
|
||||
@users = User.all.includes(contests: [ :contestants, :puzzles ])
|
||||
end
|
||||
|
||||
def edit
|
||||
|
||||
Reference in New Issue
Block a user