質問編集履歴
2
words/index 画面、words/request 画面の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -293,3 +293,13 @@
|
|
293
293
|
<% end %>
|
294
294
|
|
295
295
|
```
|
296
|
+
|
297
|
+
words/index 画面
|
298
|
+
|
299
|
+
![words/index 画面](48d64d26c53c0a42f79d83074ed2fe57.png)
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
words/request 画面
|
304
|
+
|
305
|
+
![words/request 画面](73be900c51474c279e64bf934c2a09b1.png)
|
1
word.csv (追加) words/index.html (変更)
test
CHANGED
File without changes
|
test
CHANGED
@@ -175,3 +175,121 @@
|
|
175
175
|
"choice"=>["word_id", "word_id", "word_id"]}
|
176
176
|
|
177
177
|
```
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
---------------------------------------------------------------------------
|
182
|
+
|
183
|
+
追記
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
word.csv (今回は練習でできれば将来csvファイルを増やしたいのですが--。)
|
188
|
+
|
189
|
+
```ruby
|
190
|
+
|
191
|
+
id,enword,jaword
|
192
|
+
|
193
|
+
1,apple,りんご
|
194
|
+
|
195
|
+
2,orange,オレンジ
|
196
|
+
|
197
|
+
3,red,赤
|
198
|
+
|
199
|
+
4,black,黒
|
200
|
+
|
201
|
+
5,white,白
|
202
|
+
|
203
|
+
6,tree,木
|
204
|
+
|
205
|
+
7,mountain,山
|
206
|
+
|
207
|
+
8,sky,空
|
208
|
+
|
209
|
+
9,star,星
|
210
|
+
|
211
|
+
10,day,日
|
212
|
+
|
213
|
+
```
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
words/index.html
|
218
|
+
|
219
|
+
(以下のような形式にすべきでしょうか? 現在はroutesの不具合等でエラーが出ます)
|
220
|
+
|
221
|
+
```ruby
|
222
|
+
|
223
|
+
<%= form_with model: @words, local: true do |f| %>
|
224
|
+
|
225
|
+
<%= f.check_box :choice %>
|
226
|
+
|
227
|
+
<%= f.submit %>
|
228
|
+
|
229
|
+
<% end %>
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
<table class="table-responsive table table-striped table-bordered">
|
234
|
+
|
235
|
+
<thead>
|
236
|
+
|
237
|
+
<tr>
|
238
|
+
|
239
|
+
<th></th>
|
240
|
+
|
241
|
+
<th>English</th>
|
242
|
+
|
243
|
+
<th>Japanese</th>
|
244
|
+
|
245
|
+
<th collapse="3"></th>
|
246
|
+
|
247
|
+
</tr>
|
248
|
+
|
249
|
+
</thead>
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
<tbody>
|
254
|
+
|
255
|
+
<% @words.each do |word| %>
|
256
|
+
|
257
|
+
<tr>
|
258
|
+
|
259
|
+
<td><input type="checkbox" name="choice[]" value="word.id" ></td>
|
260
|
+
|
261
|
+
<td><%= word.enword %></td>
|
262
|
+
|
263
|
+
<td><%= word.jaword %></td>
|
264
|
+
|
265
|
+
<td><%= link_to 'Show', word %></td>
|
266
|
+
|
267
|
+
<td><%= link_to 'Edit', edit_word_path(word) %></td>
|
268
|
+
|
269
|
+
<td><%= link_to 'Destroy', word, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
270
|
+
|
271
|
+
</tr>
|
272
|
+
|
273
|
+
<% end %>
|
274
|
+
|
275
|
+
</tbody>
|
276
|
+
|
277
|
+
</table>
|
278
|
+
|
279
|
+
```
|
280
|
+
|
281
|
+
現在のwords/index.html
|
282
|
+
|
283
|
+
```ruby
|
284
|
+
|
285
|
+
<%= form_tag("/words/request") do %>
|
286
|
+
|
287
|
+
<table>
|
288
|
+
|
289
|
+
——————
|
290
|
+
|
291
|
+
</table>
|
292
|
+
|
293
|
+
<% end %>
|
294
|
+
|
295
|
+
```
|