質問編集履歴
1
users_controller.rbを追加しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -234,6 +234,58 @@
|
|
234
234
|
|
235
235
|
|
236
236
|
|
237
|
+
users_controller.rb
|
238
|
+
|
239
|
+
```
|
240
|
+
|
241
|
+
class UsersController < ApplicationController
|
242
|
+
|
243
|
+
def index
|
244
|
+
|
245
|
+
@user = current_user
|
246
|
+
|
247
|
+
@users = User.all
|
248
|
+
|
249
|
+
end
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
def show
|
254
|
+
|
255
|
+
@user = User.find(params[:id])
|
256
|
+
|
257
|
+
@book = Book.new
|
258
|
+
|
259
|
+
@books = @user.books
|
260
|
+
|
261
|
+
end
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
def edit
|
266
|
+
|
267
|
+
@user = User.find(params[:id])
|
268
|
+
|
269
|
+
end
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
private
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
def user_params
|
278
|
+
|
279
|
+
params.require(:user).permit(:name, :introduction, :profile_image_id)
|
280
|
+
|
281
|
+
end
|
282
|
+
|
283
|
+
end
|
284
|
+
|
285
|
+
```
|
286
|
+
|
287
|
+
|
288
|
+
|
237
289
|
20191003161330_create_books.rb
|
238
290
|
|
239
291
|
```
|