質問編集履歴
5
結果の追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -64,4 +64,9 @@
|
|
64
64
|
|
65
65
|
###結果
|
66
66
|
上記のif文でN+1が発生しているようでしたが、Bulletでも検出できず悩んでおりました。
|
67
|
+
また
|
68
|
+
```ruby
|
69
|
+
ChildEvent.includes(events: :categories).references(:events,:categories)
|
70
|
+
```
|
71
|
+
などのscopeでも試しましたが同じ結果でした。
|
67
72
|
なにかアドバイスをいただければ幸いです。
|
4
タグの追加
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
3
過分の削除
title
CHANGED
File without changes
|
body
CHANGED
@@ -41,9 +41,8 @@
|
|
41
41
|
上記の状態でControllerは下記のようにDBから取得している。
|
42
42
|
```ruby
|
43
43
|
@categories = Category.all
|
44
|
-
@events = EventChild.with_parent_events.with_categories
|
44
|
+
@events = EventChild.with_parent_events.with_categories
|
45
45
|
```
|
46
|
-
この@eventsをviewに渡しています。
|
47
46
|
|
48
47
|
### View関連
|
49
48
|
|
2
初心者マーク追加
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
1
Railsのバージョンを追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
###前提・実現したいこと
|
2
|
+
Rails 4.2.5です。
|
2
|
-
|
3
|
+
Viewを表示する際にN+1問題が発生しているので原因と対策を教えていただきたく思います。
|
3
4
|
|
4
5
|
親イベントと子イベントをjoinした一覧の表示を表示したいのですが、設定は下記の通りとなっております。
|
5
6
|
|