0
0

More than 3 years have passed since last update.

Rails devise + google_oauth2 でログイン後のリダイレクト先を指定

Posted at

applictaion_controller.rbではリダイレクト処理したくない

理由は特にない。気分の問題。

omniauth_callbacks_controller.rbに書く

app/controllers/chichinpuipui/omniauth_callbacks_controller.rb
  def google_oauth2
    ...
    ...
  end

  protected

  #ログイン後のリダイレクト先
  def after_sign_in_path_for(resource)
    itaino_itaino_tondeke_path
  end

google_oauth2メソッドより上にprotected書くとエラーになるので注意。

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