質問編集履歴
2
エラーの画像を追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
【問題点】
|
1
|
+
【問題点】
|
2
2
|
複数のテーブルを結合して値を取得したいが、メインのテーブルの値しか取得できない
|
3
3
|
|
4
4
|
【ソース】
|
1
モデル定義追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -22,4 +22,15 @@
|
|
22
22
|
and superior_chk_kbn = '1'
|
23
23
|
order by user.employee_number
|
24
24
|
")
|
25
|
+
```
|
26
|
+
|
27
|
+
```
|
28
|
+
class User < ApplicationRecord
|
29
|
+
has_many :attendance_news, dependent: :destroy
|
30
|
+
end
|
31
|
+
```
|
32
|
+
```
|
33
|
+
class AttendanceNews < ApplicationRecord
|
34
|
+
belongs_to :user
|
35
|
+
end
|
25
36
|
```
|