質問編集履歴
3
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -69,3 +69,35 @@
|
|
69
69
|
関係性
|
70
70
|
|
71
71
|
![イメージ説明](f34a9cfe6559a972dcb61ef52904bee6.png)
|
72
|
+
|
73
|
+
```model
|
74
|
+
|
75
|
+
class User < ApplicationRecord
|
76
|
+
|
77
|
+
has_many :groups, through: :group_users
|
78
|
+
|
79
|
+
has_many :group_users
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
class Group < ApplicationRecord
|
86
|
+
|
87
|
+
has_many :users, through: :group_users
|
88
|
+
|
89
|
+
has_many :group_users
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
class GroupUser < ApplicationRecord
|
96
|
+
|
97
|
+
belongs_to :group
|
98
|
+
|
99
|
+
belongs_to :user
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
```
|
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -63,3 +63,9 @@
|
|
63
63
|
```
|
64
64
|
|
65
65
|
お分かりの方、ぜひ宜しくお願いいたします。
|
66
|
+
|
67
|
+
###追記
|
68
|
+
|
69
|
+
関係性
|
70
|
+
|
71
|
+
![イメージ説明](f34a9cfe6559a972dcb61ef52904bee6.png)
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
```ここに言語を入力
|
22
22
|
|
23
|
-
GroupUser.where(
|
23
|
+
GroupUser.where(mydate: Date.today)
|
24
24
|
|
25
25
|
```
|
26
26
|
|
@@ -31,6 +31,8 @@
|
|
31
31
|
t.integer "group_id"
|
32
32
|
|
33
33
|
t.integer "user_id"
|
34
|
+
|
35
|
+
t.datetime "mydate"
|
34
36
|
|
35
37
|
t.datetime "created_at", null: false
|
36
38
|
|