ApplicationControllerでは、devise docsによると、How To: Redirect to a specific page on successful sign in and sign outは、デバッグコンソールでさえもケーススイッチに到達できません。 'resource.class == User is is本当です。私が逃したRails処理のどの部分がわからないのですが、何かヒントをいただければ幸いです!Rails 4のdevise gemで、after_sign_in_path_forを無効にしても無効です
# ApplicationController.rb
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
protected
def after_sign_in_path_for(resource)
# check for the class of the object to determine what type it is
binding.pry
case resource.class
when User
puts "user redirect ==== "
return session.delete(:return_to) || current_user_path
else
puts "super call ....."
super
end
end
end
ありがとうございました! ApplicationController#after_sign_in_path_forをオーバーライドするのではなく、SessionControllerのカスタマイズの背後にある考え方を説明することができれば、あなたの答えはより良いと思います。 – user746403