LoginSignup
1
0

More than 1 year has passed since last update.

deviseのメモ

Last updated at Posted at 2021-08-17

サインアップ、サインイン後のリダイレクト

application_controller.rb
#サインアップ
def after_sign_up_path_for(resource)
    リダイレクト先のパス名
end

#サインイン
def after_sign_in_path_for(resource)
    リダイレクト先のパス名
end

ログアウト

ビュー
<%= link_to 'ログアウト', destroy_user_session_path, method: :delete %>

ログイン済ユーザーのみにアクセスを許可する

ログインが必要なコントローラに

before_action :authenticate_user! 

ログインしているかの判定

ログインしていれば、True
していなければ、Falseを返す

user_signed_in?
1
0
1

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
1
0