質問編集履歴

1

UserControllerを追加しました

2019/10/13 05:29

投稿

bok_sakai
bok_sakai

スコア20

test CHANGED
File without changes
test CHANGED
@@ -87,3 +87,51 @@
87
87
  </body>
88
88
 
89
89
  ```
90
+
91
+
92
+
93
+ ```
94
+
95
+ #app/controller/users_controller
96
+
97
+
98
+
99
+ class UsersController < ApplicationController
100
+
101
+
102
+
103
+ def index
104
+
105
+ @users = User.all
106
+
107
+ end
108
+
109
+
110
+
111
+ def show
112
+
113
+ @user = User.find(params[:id]) #追記
114
+
115
+ end
116
+
117
+
118
+
119
+ def edit
120
+
121
+ @user = User.find(params[:id]) #追記
122
+
123
+ end
124
+
125
+
126
+
127
+ def user_params
128
+
129
+ params.require(:user).permit(:username, :nickname, :email, :password, :password_confirmation, :icon, :profile)
130
+
131
+ end
132
+
133
+
134
+
135
+ end
136
+
137
+ ```