teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

修正依頼の回答として。

2020/07/19 11:15

投稿

SoichiSugimo
SoichiSugimo

スコア13

title CHANGED
File without changes
body CHANGED
@@ -64,6 +64,17 @@
64
64
  render 'edit'
65
65
  end
66
66
  end
67
+
68
+
69
+
70
+
71
+
72
+ private
73
+
74
+ def user_params
75
+ params.require(:user).permit(:name, :email, :password,
76
+ :password_confirmation, :introduction)
77
+ end
67
78
  ```
68
79
 
69
80
  よろしくお願いします。

1

変更依頼への回答。

2020/07/19 11:15

投稿

SoichiSugimo
SoichiSugimo

スコア13

title CHANGED
File without changes
body CHANGED
@@ -47,4 +47,23 @@
47
47
  introduction: "I am the developer of this app.")
48
48
  ```
49
49
 
50
+
51
+
52
+ Controller
53
+ ```
54
+ def edit
55
+ @user = User.find(params[:id])
56
+ end
57
+
58
+ def update
59
+ @user = User.find(params[:id])
60
+ if @user.update(user_params)
61
+ flash[:success] = "Profile updated"
62
+ redirect_to @user
63
+ else
64
+ render 'edit'
65
+ end
66
+ end
67
+ ```
68
+
50
69
  よろしくお願いします。