回答編集履歴
2
コメントはマークダウンできないようなので回答追記
test
CHANGED
@@ -5,3 +5,53 @@
|
|
5
5
|
%= form_for(@poem, url: poems_path, html: { method: :put } do |f| %>
|
6
6
|
|
7
7
|
```
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
◆追記(ルーティングについて)
|
14
|
+
|
15
|
+
ルーティングを現状と変えないなら
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
```
|
20
|
+
|
21
|
+
resource :poems, only: [:edit, :update]
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
GET /poems/edit →今日のpoem編集
|
26
|
+
|
27
|
+
PUT /poems → 今日のpoem更新
|
28
|
+
|
29
|
+
GET /poems/edit?date=xxx → xxx日のpoem編集
|
30
|
+
|
31
|
+
```
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
※以下は個人的な見解です
|
36
|
+
|
37
|
+
ただし1日ごとに1つのpoemを作るならパラメータでdateを受け渡すよりも、
|
38
|
+
|
39
|
+
日付ごとの各poemにそれぞれURLがある方が良いと思います。
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
```
|
44
|
+
|
45
|
+
resources :poems, param:date, only: [:edit, :update]
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
GET /poems/xxx/edit → xxx日のpoem編集
|
50
|
+
|
51
|
+
PUT /poems/xxx → xxx日のpoem更新
|
52
|
+
|
53
|
+
```
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
xxxはparams[:date]で受けることが出来ます。
|
1
誤った捕捉説明を削除
test
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
form_forから送られるリクエストはデフォルトPOSTなのでcreateにルーティングされます。
|
2
|
-
|
3
1
|
PUT送ればupdateされると思います
|
4
2
|
|
5
3
|
```
|