質問編集履歴

3

タグ追加

2019/01/18 00:53

投稿

Cafemocha
Cafemocha

スコア37

test CHANGED
File without changes
test CHANGED
File without changes

2

文字削除

2019/01/18 00:53

投稿

Cafemocha
Cafemocha

スコア37

test CHANGED
File without changes
test CHANGED
@@ -31,8 +31,6 @@
31
31
  class Share < ApplicationRecord
32
32
 
33
33
  belongs_to :user
34
-
35
- belongs_to :acount
36
34
 
37
35
  belongs_to :schedule
38
36
 

1

記載追加

2019/01/16 09:10

投稿

Cafemocha
Cafemocha

スコア37

test CHANGED
File without changes
test CHANGED
@@ -11,6 +11,36 @@
11
11
 
12
12
 
13
13
  ご教示よろしくお願いいたします。
14
+
15
+
16
+
17
+ ```Model
18
+
19
+ class Schedule < ApplicationRecord
20
+
21
+ belongs_to :user
22
+
23
+ belongs_to :event, optional: true
24
+
25
+ has_many :shares, as: :shareable
26
+
27
+ accepts_nested_attributes_for :shares, allow_destroy: true
28
+
29
+
30
+
31
+ class Share < ApplicationRecord
32
+
33
+ belongs_to :user
34
+
35
+ belongs_to :acount
36
+
37
+ belongs_to :schedule
38
+
39
+ belongs_to :shareable, polymorphic: true
40
+
41
+
42
+
43
+ ```
14
44
 
15
45
 
16
46