サインイン後のパスについては、次の操作を実行できます。
def after_sign_in_path_for(resource)
if resource.class == User
if resource.sign_in_count < 2
'/dashboard'
else
'/dashboard/home'
end
elsif resource.class == AdminUser
I18n.locale = "en"
'/admin/dashboard'
else
I18n.locale = "en"
'/'
end
end
しかし、自分のユーザーが aUser
またはAdminUser
afterかどうかを確認するにはどうすればよいsign_out
ですか?
def after_sign_out_path_for(resource_or_scope)
if resource_or_scope == AdminUser
これは動作しません。それを確認する方法はありますか?
注: 私はモンキー パッチを実行し、管理者用に新しいルートを定義しましたが、問題は解決しましたがafter_sign_out_path_for
、Devise の方法を使用して実装する方法があるかどうか知りたいですか?