質問編集履歴
1
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -87,3 +87,101 @@
|
|
87
87
|
root GET / team#index
|
88
88
|
|
89
89
|
```
|
90
|
+
|
91
|
+
追記 teams_controller.tb
|
92
|
+
|
93
|
+
```ここに言語を入力
|
94
|
+
|
95
|
+
class TeamsController < ApplicationController
|
96
|
+
|
97
|
+
def index
|
98
|
+
|
99
|
+
@teams = Team.all
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
def show
|
104
|
+
|
105
|
+
@team = Team.find params[:id]
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
def new
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
def edit
|
118
|
+
|
119
|
+
@team = Team.find params[:id]
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
def create
|
126
|
+
|
127
|
+
@team = Team.new(team_params)
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
if @team.save
|
132
|
+
|
133
|
+
redirect_to team_path(@team)
|
134
|
+
|
135
|
+
else
|
136
|
+
|
137
|
+
render 'new'
|
138
|
+
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
def update
|
146
|
+
|
147
|
+
@team = Team.find params[:id]
|
148
|
+
|
149
|
+
if @team.update(team_params)
|
150
|
+
|
151
|
+
redirect_to @team
|
152
|
+
|
153
|
+
else
|
154
|
+
|
155
|
+
render 'edit'
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
end
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
def destroy
|
164
|
+
|
165
|
+
@team = Team.find params[:id]
|
166
|
+
|
167
|
+
@team.destroy
|
168
|
+
|
169
|
+
redirect_to teams_path
|
170
|
+
|
171
|
+
end
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
def team_params
|
176
|
+
|
177
|
+
params.require(:team).permit(:name, :text)
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
```
|