質問編集履歴

1

controller を追加しました

2021/06/20 05:32

投稿

sanbon
sanbon

スコア1

test CHANGED
File without changes
test CHANGED
@@ -62,6 +62,60 @@
62
62
 
63
63
 
64
64
 
65
+ ```controller
66
+
67
+ class VideosController < ApplicationController
68
+
69
+
70
+
71
+ def new
72
+
73
+ @video = Video.new
74
+
75
+ end
76
+
77
+
78
+
79
+ def create
80
+
81
+ @video = Video.new(video_params)
82
+
83
+ @video.save
84
+
85
+ redirect_to '/'
86
+
87
+
88
+
89
+ end
90
+
91
+
92
+
93
+ def show
94
+
95
+ @video = Video.all
96
+
97
+ end
98
+
99
+
100
+
101
+
102
+
103
+ private
104
+
105
+
106
+
107
+ def video_params
108
+
109
+ params.require(:video).permit(:title, :introduction, :video)
110
+
111
+ end
112
+
113
+
114
+
115
+ end
116
+
117
+ ```
118
+
65
119
 
66
120
 
67
121
  ### 試したこと