Skip to content

Commit 040ce5f

Browse files
authored
Merge pull request #1685 from kimihito/fix/dojos-n1
`/dojos` でSQLクエリのN+1問題を修正
2 parents a382534 + 862947d commit 040ce5f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/controllers/dojos_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class DojosController < ApplicationController
33
# GET /dojos[.json]
44
def index
55
@dojos = []
6-
Dojo.order(order: :asc).all.each do |dojo|
6+
Dojo.includes(:prefecture).order(order: :asc).all.each do |dojo|
77
@dojos << {
88
id: dojo.id,
99
url: dojo.url,

0 commit comments

Comments
 (0)