質問編集履歴
7
誤字修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -33,4 +33,4 @@
|
|
33
33
|
|
34
34
|
~~company_params[:updated_user_id] = current_user.id #deviseを利用~~
|
35
35
|
↓
|
36
|
-
|
36
|
+
@company.updated_user_id = current_user.id #deviseを利用
|
6
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -25,4 +25,12 @@
|
|
25
25
|
def company_params
|
26
26
|
params.require(:company).permit(:company_name,:updated_user_id)
|
27
27
|
end
|
28
|
-
```
|
28
|
+
```
|
29
|
+
|
30
|
+
###追記
|
31
|
+
下記で実現できましたが、できればもう少しスマートにparamsを変更できればと思います。
|
32
|
+
引き続きどうぞよろしくお願いいたします。
|
33
|
+
|
34
|
+
~~company_params[:updated_user_id] = current_user.id #deviseを利用~~
|
35
|
+
↓
|
36
|
+
company_params[:updated_user_id] = current_user.id #deviseを利用
|
5
タグの追加
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
4
タイトル修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
Rails パラメータ
|
1
|
+
Rails コントローラでパラメータ追加
|
body
CHANGED
File without changes
|
3
文法修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,10 +13,10 @@
|
|
13
13
|
respond_to do |format|
|
14
14
|
if @company.update(company_params)
|
15
15
|
format.html { redirect_to company_path, notice: 'Company was successfully updated.' }
|
16
|
-
format.json { render :show, status: :ok, location: @
|
16
|
+
format.json { render :show, status: :ok, location: @company }
|
17
17
|
else
|
18
18
|
format.html { render :edit }
|
19
|
-
format.json { render json: @
|
19
|
+
format.json { render json: @company.errors, status: :unprocessable_entity }
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
2
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
```ここに言語を入力
|
9
9
|
def update
|
10
10
|
|
11
|
-
company_params[:updated_user_id] = current_user.id
|
11
|
+
company_params[:updated_user_id] = current_user.id #deviseを利用
|
12
12
|
|
13
13
|
respond_to do |format|
|
14
14
|
if @company.update(company_params)
|
1
文法の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
コントローラーでアップデートする前に、update_user_idのパラメータを追加したいです。
|
1
|
+
コントローラーでアップデートする前に、ビューで取得していないupdate_user_idのパラメータを追加したいです。
|
2
2
|
|
3
3
|
こちらを参考にしてみましたがうまくできませんでした。
|
4
4
|
https://stackoverflow.com/questions/5014804/rails-change-value-of-parameter-in-controller/5014844
|