left out join

dev_forum
jingquan huang 5 years ago
parent 35d52b5116
commit d1f721b249

@ -150,7 +150,7 @@ class ChallengesController < ApplicationController
uid_logger("identifier: #{params}")
# 通过调试发现 这里includes(:games)性能会慢10倍
# @challenges = @shixun.challenges.fields_for_list
@challenges = Challenge.fields_for_list.includes(:games).where("challenges.shixun_id" => @shixun.id)
@challenges = Challenge.fields_for_list.left_outer_joins(:games).where("challenges.shixun_id" => @shixun.id)
# @challenges = Challenge.includes(:games).where("games.user_id" => 12).where(shixun_id: @shixun.id)

Loading…
Cancel
Save