teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

エラーの画像を追加

2019/09/25 08:03

投稿

otomo21
otomo21

スコア14

title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,4 @@
1
- 【問題点】
1
+ ![イメージ説明](9d96c150a49f7e5099a6d5e73eab9046.png)【問題点】
2
2
  複数のテーブルを結合して値を取得したいが、メインのテーブルの値しか取得できない
3
3
 
4
4
  【ソース】

1

モデル定義追加

2019/09/25 08:02

投稿

otomo21
otomo21

スコア14

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
  ```