質問編集履歴
1
ファイルの追加
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
rails エラー
|
1
|
+
rails エラー「closed stream」
|
body
CHANGED
@@ -17,6 +17,42 @@
|
|
17
17
|
|
18
18
|
```
|
19
19
|
|
20
|
+
原因と思われる、ファイル
|
21
|
+
```user_controller.rb
|
22
|
+
class UsersController < ApplicationController
|
23
|
+
def index
|
24
|
+
@users = User.all
|
25
|
+
end
|
26
|
+
|
27
|
+
def show
|
28
|
+
@user = User.find(params[:id])
|
29
|
+
end
|
30
|
+
|
31
|
+
def edit
|
32
|
+
@user = User.find(params[:id])
|
33
|
+
if @user != current_user
|
34
|
+
redirect_to user_path(current_user), alert: "不正なアクセスです。"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
def update
|
38
|
+
@user = User.find(params[:id])
|
39
|
+
@user.update(user_params)
|
40
|
+
if @user.update(user_params)
|
41
|
+
redirect_to user_path(@user), notice: "ユーザー情報を更新しました。"
|
42
|
+
else
|
43
|
+
render :edit
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
def user_params
|
49
|
+
params.require(:user).permit(:username, :email, :profile, :profile_image)
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
```
|
55
|
+
|
20
56
|
色々調べましたが、結局何が原因かわからず、どう直せば良いかもわからず‥‥
|
21
57
|
|
22
58
|
|