回答編集履歴
1
参考にしたサイトに目を通しました。
answer
CHANGED
@@ -3,4 +3,27 @@
|
|
3
3
|
redirect_to edit_user_path
|
4
4
|
↓
|
5
5
|
redirect_to edit_user_path(@user.id)
|
6
|
-
```
|
6
|
+
```
|
7
|
+
|
8
|
+
------------
|
9
|
+
『追記』
|
10
|
+
参考にしたサイトを見ました。
|
11
|
+
★をつけた行、これ、renderの間違いじゃないかな?
|
12
|
+
|
13
|
+
```
|
14
|
+
def update
|
15
|
+
@hoge = Hoge.find(params[:id])
|
16
|
+
@hoge.update_attributes(params[:hoge])
|
17
|
+
if @hoget.save
|
18
|
+
flash[:notice] = "更新しました!"
|
19
|
+
redirect_to 'index'
|
20
|
+
else
|
21
|
+
@hoge.attributes = params[:hoeg]
|
22
|
+
flash[:notice] = "失敗しました!"
|
23
|
+
redirect_to edit_hoge_path ←★
|
24
|
+
end
|
25
|
+
end
|
26
|
+
```
|
27
|
+
|
28
|
+
文章中には、renderという言葉を使ってるので。
|
29
|
+
> 今回でいうと、@hoge = hoge.attribute(params[:hoge])の中に入力された値が格納されているので、これをrennderの前に代入しましょう。
|