質問編集履歴
3
x
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
-
|
9
|
+
コントローラー
|
10
10
|
|
11
11
|
```ruby
|
12
12
|
|
2
ss
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
例えば「モデル
|
1
|
+
例えば「モデルA」「モデルB」「モデルC」「モデルD」が存在し、一つのコントローラーでこれらのモデルにデータを保存していくことは可能ですか?
|
2
2
|
|
3
3
|
モデルの数だけコントローラーを作成しなければならないのでしょうか?
|
4
4
|
|
1
a
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,7 +12,13 @@
|
|
12
12
|
|
13
13
|
def index
|
14
14
|
|
15
|
-
|
15
|
+
@a = A.last
|
16
|
+
|
17
|
+
@b = B.last
|
18
|
+
|
19
|
+
@c = C.last
|
20
|
+
|
21
|
+
@d = D.last
|
16
22
|
|
17
23
|
end
|
18
24
|
|
@@ -22,6 +28,12 @@
|
|
22
28
|
|
23
29
|
@a = A.new
|
24
30
|
|
31
|
+
@b = B.new
|
32
|
+
|
33
|
+
@c = C.new
|
34
|
+
|
35
|
+
@d = D.new
|
36
|
+
|
25
37
|
end
|
26
38
|
|
27
39
|
|
@@ -30,6 +42,12 @@
|
|
30
42
|
|
31
43
|
@a = A.new(schedule_params)
|
32
44
|
|
45
|
+
@b = B.new(schedule_params)
|
46
|
+
|
47
|
+
@c = C.new(schedule_params)
|
48
|
+
|
49
|
+
@d = D.new(schedule_params)
|
50
|
+
|
33
51
|
end
|
34
52
|
|
35
53
|
```
|