0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

devise current_userをインスタンス変数に代入する

Last updated at Posted at 2021-11-21

#ログインユーザーのデータをインスタンス変数に代入する

###環境
rails 5.2.6
使用Gem:devise

#記述方法

インスタンス変数 = current_user

current_userはDevise使用時にだけ使えるメソッド
ログインユーザーの(Userモデルで定義している)カラム情報を呼び出す事ができる

イコールの右側にcurrent_userとすることで、インスタンス変数に代入が可能

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?