質問編集履歴

1

context[:current_resource]に変更

2021/02/25 13:14

投稿

koyo
koyo

スコア8

test CHANGED
@@ -1 +1 @@
1
- current_usernilにる。なぜ?(undefined local variable or method `current_user')
1
+ context[:current_resource]使えなぜ?(undefined local variable or method `current_user')
test CHANGED
@@ -1,4 +1,4 @@
1
- graphql-deviseを導入していますが、下記のよう設定をしてもcurrent_userを使えません
1
+ graphql-deviseを導入していますが、下記のよう設定をしてもcontext[:current_resource]を使えません
2
2
 
3
3
  なぜでしょうか・
4
4
 
@@ -120,6 +120,8 @@
120
120
 
121
121
  def update!
122
122
 
123
+ current_user = context[:current_resource]
124
+
123
125
  current_user.assign_attributes(first_name: first_name, last_name: last_name, image: valid_image)
124
126
 
125
127
  current_user.update