回答編集履歴

1

参考にしたサイトに目を通しました。

2018/06/11 11:17

投稿

dobby618
dobby618

スコア302

test CHANGED
@@ -9,3 +9,49 @@
9
9
  redirect_to edit_user_path(@user.id)
10
10
 
11
11
  ```
12
+
13
+
14
+
15
+ ------------
16
+
17
+ 『追記』
18
+
19
+ 参考にしたサイトを見ました。
20
+
21
+ ★をつけた行、これ、renderの間違いじゃないかな?
22
+
23
+
24
+
25
+ ```
26
+
27
+ def update
28
+
29
+ @hoge = Hoge.find(params[:id])
30
+
31
+ @hoge.update_attributes(params[:hoge])
32
+
33
+ if @hoget.save
34
+
35
+ flash[:notice] = "更新しました!"
36
+
37
+ redirect_to 'index'
38
+
39
+ else
40
+
41
+ @hoge.attributes = params[:hoeg]
42
+
43
+ flash[:notice] = "失敗しました!"
44
+
45
+ redirect_to edit_hoge_path ←★
46
+
47
+ end
48
+
49
+ end
50
+
51
+ ```
52
+
53
+
54
+
55
+ 文章中には、renderという言葉を使ってるので。
56
+
57
+ > 今回でいうと、@hoge = hoge.attribute(params[:hoge])の中に入力された値が格納されているので、これをrennderの前に代入しましょう。